You are on page 1of 299

Site Investigation based on

Return Flow in Horizontal


Directional Drilling
Marsdiep Project

Tom Hijnekamp
TU Delft | Deltares
Site Investigation based on Return Flow
in Horizontal Directional Drilling
Marsdiep Project

Master Thesis

to obtain the degree of Master of Science


at the Delft University of Technology,
to be defended publicly on Monday April 18, 2016 at 11:00 AM.

Student: T.A.J. (Tom) Hijnekamp


Student number: 1508466
E-mail: tomhijnekamp@gmail.com

Supervisor: Dr. Ir. D.J.M. Ngan-Tillard, TU Delft


Thesis committee: Prof. Dr. Ir. J.D. Jansen, TU Delft
Dr. Ir. W. Broere, TU Delft
D.A. den Hamer, MSc., TU Delft
Ir. J.J. van Meerten, Deltares
Dr. H.M.G. Kruse, Deltares

This thesis is confidential and cannot be made public until September 1, 2016.

An electronic version of this thesis is available at http://repository.tudelft.nl/.


Preface
This thesis is the conclusion of the MSc track of Geo-Engineering at the faculty of Civil Engineering and Geo-
sciences of Delft University of Technology. The thesis is supported by and conducted at Deltares.

When I started the context of my thesis was roughly known, ie. within the Marsdiep project at Deltares there
were different subjects suitably for a master thesis. The Marsdiep project was the investigation into the feasibility
of constructing a pipeline between Texel and Den Helder using Horizontal Directional Drilling (HDD).
At the start in March I wrote a research proposal, in which I was not only going to relate the samples to the
soil by studying the influences on and the processes going on in the drilling fluid but I was going to correct the
initial estimation of the formation parameters as well. Unfortunately for me it turned out to be as ambitious as
unrealistic given the scope of the data acquisition (on which I had very limited influence due to contractual and
financial requirements) and the time restraints. As soon as this became clear I decided to change the focus of this
research.
Since my background is Applied Earth Sciences I decided to focus more on the geology. Increasing the scale
and limiting the scope to a more reasonable level, allowed me to take more distance from the fluid and transport
processes going on in the borehole.
In order to improve the geological cross-section I still required the source locations of the samples. The
source locations are calculated by rewriting, expanding and adapting a method I used on site in Den Helder to
calculate the diameter of the borehole during a flow test. After some trial and error and a significant amount of
time spend on data processing, the results can be found in this thesis.

Of course I could not have done this without support and input from others. First I would like to thank my
graduation committee for their support. Without detracting from the input and efforts of the other members of
the graduation committee, I would especially like to thank Dianne Den Hamer, from TU Delft, who was working
for Deltares on site in both Texel and Den Helder, and was very helpful in getting this research to the point where
it is now. From André Pietjouw from Episcope, Jonno Pouw and Ton Bennen, both from PWN and all present on
site in both locations, I learned a lot about the HDD process as well as about regular practice in the construction
industry, for which I am thankful.
Furthermore I would like to thank the following persons that were working on the Marsdiep project and
related projects and were always available for questions; Wim Post, David Nugroho and Mike Woning, all
working at Deltares. I would also like to thank Dick Mastbergen and Arno Talmon, both working at Deltares, for
their help with questions I had with regard to fluid properties and processes. From Deltares I would also like to
thank Jonathan Nuttall for his help and patience with regards to programming related issues. In addition I want
to thank Freek Busschers and Jeroen Schokker, both working at TNO, for identifying the samples and helping
me understand the geology of the region.
Last but not least I would like to thank my friends and family. By asking questions and showing interest they
forced me to take a look from different perspectives which led to new insights and improvements of this research.

Tom Hijnekamp
Delft, April 2016

iii
Abstract
The focus of this research is on samples taken from the return flow. With these samples and within the context of
the Marsdiep project it is investigated if Horizontal Directional Drilling (HDD) can be used as a Site Investigation
(SI) technique. In the Marsdiep project the feasibility of a pipeline constructed using HDD between the island
Texel and Den Helder is investigated. Marsdiep is the name of the water and tidal gully between Texel and
Den Helder. Regular SI techniques are not feasible, due to among others; the length of 4.5km, the depth that is
required for a HDD of this length and the tidal gully.
The geology of the area is unknown so SI is required. For this purpose pilot drillings, the first part of a regular
HDD project, are made at NAP-65m and NAP-85m from both Texel and Den Helder. These pilot drillings are
adapted so that additional data are acquired.
The rheologic properties are determined for samples taken from the return flow and the formation of the
samples is determined after sieving.
A range of possible source locations of the samples are calculated, using different scenarios based on the
uncertainty with regards to the borehole diameter and the loss of drilling fluid. The results of the scenarios are
compared to the results of the initial SIs, which consists of a seismic survey, onshore, vertical drillings and Cone
Penetration Tests (CPTs). It is found that the source location of the samples can be calculated as one of the
scenarios gave accurate results (scenario 5, drilling fluid loss 7% and a borehole diameter of 0.4m and 0.45m for
respectively Texel and Den Helder).
A geological cross-section is constructed based on the results of scenario 5 and initial SIs.
In addition to the geology the suitability of HDD as a SI technique is investigated. It is found that with minor
adaptations to a regular HDD it can be used in combination with other techniques to determine the geology of an
area. The other SIs are required to compare the results to and to determine the best scenario.
In order for HDD to be of use as a separate SI technique more extensive adaptations are required to minimize
the uncertainties that required the use of scenarios in this research.

iv
Samenvatting
De nadruk van dit ondezoek ligt op samples die genomen zijn van de return flow. Met deze samples en in
het kader van het Marsdiep project is ondezocht of het mogelijk is horizontaal gestuurd boren te gebruiken als
grondonderzoek techniek. In het Marsdiep project wordt de haalbaarheid ondezocht van het maken van een
pijplijn tussen Texel en Den Helder gebruik makend van gestuurd boren. Marsdiep is de naam van het water en
de getijden geul tussen Texel en Den Helder. Reguliere grondonderzoek technieken zijn niet wenselijk wegens
onder andere de lengte van 4.5 km, de benodigde diepte voor een gestuurde boring van deze lengte en de getijden
geul.
De geologie in dit gebied is onbekend dus grondonderzoek is nodig. Met dit doel zijn er pilot boringen, de
eerste fase van een regulier gestuurd boren project, uitgevoerd op NAP-65m en NAP-85m van zowel Texel als
Den Helder. Deze pilot boringen zijn aangepast zodat er extra data kunnen worden verzameld.
De vloeistof eigenschappen van de samples uit de return flow is bepaald en de formatie van de samples is
bepaald na zeving.
Een bereik aan mogelijke oorsprong locaties is berekend, gebruik makend van verschillende scenarios geba-
seerd op de onzekerheden met betrekking tot the diameter en het verlies van boorvloeistof. De resultaten van
de verschillende scenarios zijn vergeleken met de resultaten van een initieel grondonderzoek, wat bestaat uit
seismisch onderzoek, verticale boringen op Texel en in Den Helder en meerdere Cone Penetration Tests (CPT’s).
Uit dit onderzoek blijkt dat het mogelijk is om de oorsprong te berekenen aangezien de resultaten van een van
de scenarios goed kloppen wat al bekend was (scenario 5, 7% verlies van boorvloeistof en een boorgat diameter
van 0.4m en 0.45m voor respectievelijk Texel en Den Helder.).
Een geologische doorsnede is gemaakt op basis van de resultaten van scenario 5 en van de initieele grondon-
derzoeken.
Ook is de geschiktheid van gestuurd boren als grondonderzoek techniek onderzocht. Het blijkt dat met kleine
aanpassing ten opzichte van een reguliere boring het gebruikt kan worden in combinatie met andere grondonder-
zoek technieken om de geologie van het gebied te bepalen. De andere grondonderzoek technieken zijn nodig om
de resultaten mee te kunnen vergelijken en zo het meest waarschijnlijke scenario te bepalen.
Om gestuurd boren als enige techniek te gebruiken zijn meer en uitgebreidere aanpassingen nodig om de
onzekerheden te minimaliseren die het gebruik van scenarios vereisten in dit onderzoek.

v
Contents
Preface iii
Abstract iv
Samenvatting v
Abbreviations xi
Definitions xiii
Symbols xv
1 Introduction 1
1.1 Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Thesis structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Literature Review 3
2.1 Geology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Geological History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Risks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Project Risks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 General Risks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 HDD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 History of HDD (research) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2 The HDD Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Comparison of HDD with Directional Drilling (DD) . . . . . . . . . . . . . . . . . . . . . . . 12
3 Marsdiep Project 13
3.1 Locations and Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.1 Initial Cross-section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.2 Site Investigations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3 Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Pilot Drilling Descriptions 17
4.1 Site Setup and Data Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 Description of the Pilot Drillings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2.1 Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2.2 Texel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2.3 Den Helder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3 Sampling Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.4 Suitability of HDD for SI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5 Processes 23
5.1 Literature Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2 Different Fluid Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2.1 Determination of Bingham Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2.2 Determination of Herschel-Bulkley Parameters . . . . . . . . . . . . . . . . . . . . . . 24
5.2.3 Comparison Fluid Models and Determination Methods . . . . . . . . . . . . . . . . . . 25
5.3 Flow of Drilling Fluids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3.1 Infiltration Loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4 Transport. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.4.1 Transport Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.5 Lag Time or Source Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

vii
viii Contents

6 Methodology 35
6.1 Equipment and Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.2 SampleSource Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.2.1 Calculation of the Source Location (Intersection Method) . . . . . . . . . . . . . . . . . 36
6.2.2 Scenarios. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3 MarsdiepVisual Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.4 Fixes Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7 Measurements 45
7.1 Supplied Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.1.1 ProData System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.1.2 Survey Data (Drilling Paths) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.1.3 Driller Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.1.4 Drill Company Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.2 Acquired Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.2.1 On site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.2.2 Deltares, Delft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
8 Interpretation 55
8.1 Drilling Fluid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
8.1.1 Fluid Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
8.1.2 Time Dependent Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
8.2 Transport and Flow Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.2.1 Flow Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.2.2 Infiltration Loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.2.3 Transport. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.3 Sample Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.4 Source Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.4.1 Lag Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.5 Cross-section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8.6 Improved Cross-section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
8.7 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
9 Conclusions 81
9.1 Drilling Fluid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
9.1.1 Fluid Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
9.1.2 Time Dependent Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
9.1.3 Transport and Flow Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
9.2 Source Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.2.1 Lag Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.3 Cross-section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.4 Suitability of HDD for SI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10 Recommendations 85
10.1 Drilling Fluid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.1.1 Rheological Data Acquisition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.1.2 Fluid Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.1.3 Processes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.2 Source Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
10.3 Cross-section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.4 Suitability of HDD for SI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Bibliography 89
Appendices 93
A Geology Background 96
B Initial Site Investigations, Proposals and Calculations 103
C Equipment and Tests 113
Contents ix

D Additional Results 117


E Code of the SampleSource Program 133
F Code of the MarsdiepVisual Program 206
Abbreviations
AP
Appelscha Formation

API
American Petroleum Institute

BH
Bingham

BTL
Boren van Tunnels en Leidingen. Translated into English; drilling tunnels and pipelines.

BX
Boxtel Formation

CPT
Cone Penetration Test

DD
Directional Drilling

DR
Drente Formation

DS
Drillstring

EC
Electro-conductivity

EE
Eem Formation

EE-URTY
Eem Formation, Urk Tynje section

EE-BB
Eem Formation, Bruine Bank section

GBB
Gezamelijk Basisonderzoek Boortechnieken. Translated into English it is; joint fundamental research
drilling techniques.

HB
Herschel-Bulkley

xi
xii Abbreviations

HDD
Horizontal Directional Drilling

KR
Kreftenheye Formation

NA
Naaldwijk Formation

NAP
Normaal Amsterdams Peil, Translated into English; Amsterdam Ordnance Datum.

PE
Peelo Formation
PENI
Peelo Formation, Nieuwolda section

PPI
Plastics Pipe Institute
PZ
Peize Formation

ROP
Rate Of Penetration
RPM
Rotations Per Minute

SI
Site Investigation

TBM
Tunnel Boring Machine

URVE
Urk Formation, Veenhuizen section
Definitions
A.Hak-Drillcon
Drillcon is the department of the firm A.Hak that is concerned with horizontal drilling. It was the main
contractor in Texel.

Backflow
Pressure driven flow, that comes out of the borehole while the pumps are off.

Carriage
The part of the rig that is connected to the drillstring, the drill fluid flows through it and it delivers the
pushing force on the drillstring.

Coupling Time
The time required to attach or detach a pipe from the Drillstring (DS), during which the pumps are off.

Critical flow
The minimum annular average fluid velocity that would prevent stationary accumulation of cuttings in a
bed (Pilehvari et al., 1999).

Deltares
A Major Technological Research Institute in the Netherlands which is concerned with research in the areas
of water, soil and infrastructure.

DGeoPipeline
Deltares program for calculations on pipelines.

DINO
A database maintained by TNO, containing most of the Site Investigations (SIs) executed in the Nether-
lands. DINO stands for ’Data en Informatie van de Nederlandse Ondergrond’, translated into English it is;
Data and information of the Dutch subsurface.

Directional drilling
This term is used to make a distinction between the use of directional drilling in the petroleum industry,
often referred to as directional drilling, and construction industry, where the drilling method is called
horizontal directional drilling.

Drilling fluid or Mud


A fluid, often a mixture of water and bentonite, which has different tasks. Amongst others; suspending and
removing cuttings, cleaning and lubricating the drill bit and pipe and minimizing hole erosion (Ariaratnam
et al., 2007).

Drillstring
A set of pipes, also called joints, connecting the drill bit to the drill rig, transports the drilling fluid to the
drill front and can contain a cable for data transfer between the drill and the surface.

GeoTOP
A model of the dutch soil that currently spans parts of the Netherlands, with a grid size of 100x100m and
vertical resolution of 0.5 meter.

xiii
xiv Definitions

Horizontal directional drilling


See directional drilling.

Joint
A pipe of the drillstring, the joint number is the number of pipes in the borehole.

LMR
LMR is the part of a larger group of companies called Ludwig Freytag that is concerned with horizontal
drilling. It was the main contractor in Den Helder.

Mud cake
Plastering takes place in the borehole; other names include: filter cake, external plaster.
Mud crust
Plastering takes place in the formation; other names include: mud spurt, internal plaster.
Mud pulse
A system that sends pressure pulses through the drilling fluid in the drillstring in order to transfer data from
the drill head to the surface.

PWN
Drinking water company, responsible for the environmental management of dunes along the coast of North
Holland and the transport infrastructure in this region. The client for the Marsdiep project.

RD Coordinates or Rijksdriehoekscoördinaten
The national coordinate system of the Netherlands.
Reamer
A drill head used in increasing the diameter of an existing borehole.
Return flow
The drilling fluid coming out of the borehole.

Soil parameters
The parameters of the soil, with regard to the strength or permeability for example.

TNO
A Major Technological Research Institute in the Netherlands which has as goal: "TNO connects people and
knowledge to create innovations that boost the sustainable competitive strength of industry and well-being
of society." It is active in a number of different work areas.
Tripping
There are two types of tripping. Tripping back; pulling back the DS. Tripping in; moving forward in an
existing borehole. For example after changing the jet bit to a mud motor.
Symbols

Symbol Description Unit

α A factor used in calculating infiltration loss, value = 8/75 —


αH Angle of inclination, between the boring and the horizontal axis ◦

αV Angle of inclination, between the boring and the vertical axis ◦

a cr Coefficient in yield stress criterion —


cv Volumetric concentration of the grains in the drilling fluid —
K Consistency Index as used in the Herschel Bulkley and Power Law fluid models P a.s n
CF1 Used to convert [◦ ] to [mPa] —
CF2 Used to convert [RPM] to [1/s] —
VT (Hor.) The cuttings velocity on the horizontal part of the boring m/s
VT (I ncl .) The cuttings velocity on the inclined part of the boring m/s
ρr f Density of the fluid kg /m 3
ρs Density of the grains kg /m 3
∆ Deviation of the calculated shear stress from the measured shear stress —
D 15 A value for the diameter of grains at which 15% of the grains are smaller m
D 90 A value for the diameter of grains at which 90% of the grains are smaller m
DB H Diameter of the borehole m
d Diameter of the grains m
δ Distance between center of borehole en center of DS mm
Dp The pore diameter, assumed to be 4/9 * D 15 m
e f ac t or Eccentricity, defined as the distance between center of DS and borehole divided by —
the borehole radius minus the DS radius, all in [mm]
f Fannings-friction coefficient —
n Flow Index as used in the Herschel Bulkley and Power Law fluid models —
g Gravitational constant m/s 2
He Hedstrom number —
κ A blockage factor used in calculating the infiltration loss, the value depends on the —
soil; 2 or 3 is common for sand
L Length of the borehole m
LH Length of the horizontal part of the borehole m
LI Length of the inclined part of the borehole m
m local exponential factor, required to calculate the generalized Reynolds number —
— Millions of years MA
n0 Porosity —
ψT Normalized shear stress —
OD DS outer diameter of the DS m
∆P bh Pressure difference between the borehole and the surrounding groundwater Pa
PV Plastic viscosity, used in the Bingham model mP a.s
S Pressure drop, in meters of water column, 1 mwk/m is about 10 kPa (9.80665 kPa) (mwk/m)6
d P /d L Pressure drop gradient kP a/m
POut put Pump rate L/mi n
∆Q i l The volume that is lost due to infiltration into the soil m 3 /s
Rh Hydraulic radius, defined as A/P , where A is the cross-section and P is the wetted m
perimeter
rp Plug flow radius m

RO 300RP M Readout of the viscometer at 300 Rotations Per Minute (RPM)

RO 600RP M Readout of the viscometer at 600 RPM

xv
xvi Symbols

Symbol Description Unit

Re Reynolds number —
Re g en, f ul l Reynolds number, generalized —
R f ac A factor for the hydraulic diameter, 1.5 for an annulus —
Ri Radius of the drillstring m
Ro Radius of the borehole m
ROP Rate of Penetration m/s
ROP The average Rate of Penetration m/s
ψ Scaling factor used in correcting the yield point for a more accurate result in the —
Herschel Bulkley model
γ Shear rate 1/s
γ̇i Shear rate at setting i of the viscometer 1/s
γr f The shear rate of the return flow 1/s
τ Shear stress Pa
S D X (Hor.) The x-coordinate of the source of the cuttings, on the horizontal part of the boring m
S D X (I ncl .) The x-coordinate of the source of the cuttings, on the inclined part of the boring m
S DY (Hor.) The y-coordinate of the source of the cuttings, on the horizontal part of the boring m
S DY (I ncl .) The y-coordinate of the source of the cuttings, on the inclined part of the boring m
τi ,c al c Calculated shear stress at setting i of the viscometer Pa
τi ,d at a Measured shear stress at setting i of the viscometer Pa
τw Shear stress due to friction Pa
τy Yield stress of the fluid Pa
ts Average time that a grain is present in the fluid in the borehole s
t Relative settle time s
tk Average time that is required for a grain to settle s
Yg A transport parameter found in BTL 42 —
ΨT b Dimensionless transport parameter —
ΦT b Transport capacity for bed flow —
ΦT p Transport capacity for plug flow —
v Dr i l l The average drill velocity m/s
vr f Flow velocity of the mixture containing drilling fluid and soil m/s
v set t l e Settle velocity grain m/s
µ Viscosity of the drilling fluid P a.s
µ∞ Constant viscosity at very high shear rates P a.s
wi Weighting factor, given by τi − τ y —
ya Infiltration depth m
yc Cake thickness m
YP Yield point as used in the Bingham Model Pa
1
Introduction
The drinking water of Texel, an island in the northern part of the Netherlands, is supplied from the mainland
through two pipes in shallow trenches in the seabed of the Marsdiep. In 2013 the cover above one of these pipes
eroded. The pipe floated up and started to scour along the seabed under influence of the tidal currents. This
movement slowly increased the free floating length and caused an increase in stresses in the pipe. The scouring
wore the pipe wall down, where it left the seabed, to such an extent that the material failed to cope with the
stresses and started to leak before breaking (Mesman et al., 2014). During a heatwave in the summer from that
year, additional water had to be transported to Texel to meet the demand.
In order to prevent this from happening again an investigation is started in order to determine whether a
pipeline at considerable depth could be constructed using Horizontal Directional Drilling (HDD). This investi-
gation is known as the Marsdiep project, named after the waterway between Texel and the mainland.
However, the geology between Texel and Den Helder is unknown and due to the location standard Site
Investigations (SIs) techniques as required for more conventional HDD projects, ie. crossing a river or road,
would be too expensive. Therefore it is relevant to know if HDD can be used as an alternative to regular SIs.
Initial SIs have taken place and consist of one onshore vertical drilling and four Cone Penetration Tests (CPTs)
on both sides and a seismic survey of the Marsdiep.
With a length of more than 4 kilometer this is one of, if not the longest HDD project to date. This means
that the forces and required pressures are considerably higher than during a regular project. Due to the pressure
required to transport the soil in the borehole to the surface the required depth is considerable. To lower the
required pressure ’meeting in the middle’ is proposed, this halves the distance the soil needs to be transported.
’Meeting in the middle’ entails drilling from both sides and when one drilling is positioned above the borehole
of the other drilling it is gradually lowered till there is one borehole.
In order to investigate the soil pilot drillings are planned. A pilot drilling is the first phase of a HDD project.
A preliminary design is constructed based on the available data. This design will be checked and improved based
on results of the pilot drillings.
Although HDD is used in the Netherlands since the seventies of the previous century, numerous aspects are
less than well understood. In order to address these uncertainties additional data are gathered on site.

1.1. Goal
The goals of this research must be seen within the context of the following broader research question: is HDD
suitable as a SI technique? The focus of this research is on the samples taken from the return flow. The goal of
this research is to answer the following questions:
• Is it achievable to connect samples from the return flow to a source location in the subsurface?
• Is it possible to create a cross-section with the results of the samples from the return flow?
• Is HDD suitable as a SI technique and can it be improved, based on experiences in the field?
Furthermore the drilling fluid is an important item in this thesis. An investigation of the drilling fluid is required
in order to investigate and answer the first question.

1.2. Thesis structure


Chapter 2 presents the results of a literature study. In this chapter sections detailing the geology of the Marsdiep
area, risks, the HDD method and a section comparing HDD with Directional Drilling (DD) as practiced in the
petroleum industry can be found.

Chapter 3 briefly presents the Marsdiep project and the initial SIs.

1
2 1. Introduction

Chapter 4 presents the execution of the pilot drillings.

Chapter 5 presents a theoretical approach to processes happening in the borehole.

Chapter 6 presents the programs and method created in order to reach the goals of this thesis.

Chapter 7 presents characteristic measurements of the pilot drillings. These include measurements taken in the
laboratory as well as taken from the drilling rig.

Chapter 8 presents the interpretation of measurements as well as the results of the programs, eg. the fluid model
and source locations for the samples.

Chapter 9 presents the conclusions and chapter 10 contains the recommendations for further research.

The references and appendices can be found at the end.


2
Literature Review
In this chapter an overview is presented of what is known about the geology of the Marsdiep area, making use of
both public available knowledge as well as the initial Site Investigations (SIs) performed for this project. Risks
related to the geology are investigated as well. The Horizontal Directional Drilling (HDD) method is explained
and a comparison is made between HDD and Directional Drilling (DD) as practiced in the petroleum industry.

2.1. Geology
In order to know which processes occur in the borehole during HDD the geology needs to be known. Based
on the description in the literature, databases and on the preliminary survey consisting of boreholes, CPTs and
seismic data, the formations are identified and very briefly described in (Nugroho and van Meerten, 2015). The
English description of the formations can be found in table A.2, appendix A. Table A.1, also in appendix A,
contains the grain size definitions.
Table 2.1 contains the formations encountered in the Marsdiep project. Within the aim of the thesis it is very
important to know more about these formations, in order to be able to correlate the spoils of the return flow to the
formations encountered. This is done by evaluating what is already known, collected and investigated by TNO,
a dutch institute which maintains the DINO database, which contains the results of most SIs performed in the
Netherlands. Figure 2.1 shows all of the formations found in the Netherlands that have been deposited during the
Quaternary. The descriptions from TNO are general but they are extensive with respect of what is possible and
give insights into the origin of the formations. On the differences in origin, a distinction might be made when
investigating soil samples from the return flow. The differences can be used to determine if the sample is mixed,
ie. contains characteristics of different formations, due to flow and transport processes in the borehole.
The investigation of the geology is divided in two parts; first the geologic history of the area and second the
formation descriptions.

3
4 2. Literature Review

Table 2.1: Summary of formations encountered during the Marsdiep project.

Local Occurrence
Fm. Age Texel Den Helder
Naaldwijk (NA) 0.01 MA - Present Brown to gray, moderately Brown to gray, moderately
fine, weak to moderately silty fine, well sorted, weak silty
sand, which can contain traces sand, which can contain traces
of iron oxide, traces of micas, of organic material, traces of
shells, small clay layers and micas, shells and clay as well
traces of detritus at the bottom as some peat and gyttja layers
of the formation. at the bottom of the formation.
Boxtel (BX) 0.66 MA - Present Gray, very to moderately fine, Light brownish gray, very
moderately to very silty sand, fine, moderately sorted,
which can contain traces of or- slightly silty sand.
ganic material and small lay-
ers of peat and clay.
Kreftenheye (KR)* 0.24 MA - 0.01 MA Brownish, colored, coarse to medium grained sand. Can contain
peat, shell fragments and organic debris.
Eem (EE) 0.13 MA - 0.12 MA Gray to dark gray, well sorted Dark yellow to brownish gray,
sand, which can contain a few very sandy clay with micas
detritus layers at the top of or a brownish gray, very to
the formation, traces of col- moderately fine, well sorted,
ored material and clay layers. slightly silty sand with traces
of micas.
Urk - Tynje 0.85 MA - 0.13 MA Gray, moderately fine to very Light gray to gray, slightly
(URTY) coarse, slightly to very silty silty moderately coarse sand,
sand, with traces of colored with traces of organic material
material, shells, white quartz and shells and badly to moder-
and organic material and a ately well sorted.
variation in sorting.
Urk - Veenhuizen 0.85 MA - 0.13 MA Gray, weak silty moderately
(URVE) fine to moderately coarse
sand, with traces of colored
material, pink grains, few
black grains and well sorted.
Peelo - Nieuwolda 0.47 MA - 0.42 MA Dark gray, very strong clay
(PENI) - ’Pot Clay’ containing some gravel.
Peelo (PE) 0.47 MA - 0.42 MA Gray to dark gray, moderately
to badly sorted, moderately
coarse to very coarse sand,
which can contain silt, gravel
and traces of white quarts.
Appelscha (AP) 1.07 MA - 0.47 MA Gray, moderately to very
coarse, weak silty sand with
some shells and white quartz
grains.
* Not separately identified.
2.1. Geology
Figure 2.1: Overview of the formations found in the Netherlands, deposited during the Quaternary Period, with their age and
origin (TNO, 2013b).

5
6 2. Literature Review

2.1.1. Geological History


The oldest formation that is expected at the depths considered for the project is from the Pliocene epoch in the
Neogene period. This is taken as the starting point for the geological history study.
During the end of the Reuverian, the last period of the Pliocene, the temperature drops, in such an extent
that all flora characteristic for the Neogene disappears. This enables other flora types to dominate the forests.
From these new types an average temperature of about thirteen or fourteen degrees Celsius has been determined.
This change in temperature, visible in the flora, marks the end of the Neogene and the start of the Quaternary
(de Mulder et al., 2003).
The Quaternary is a dynamic period for the Netherlands. The North Sea Basin originating from the early
Neogene continues to sink which results in almost 1000 meter of sediment in the center of the basin. In the
southern part of the Netherlands the London-Brabant Massif and the Rhines Massif are continuing to rise, while
volcanism in the Eiffel continues into the Pleistocene. The movements of the soil can be divided into three
mechanisms:
• Compaction of the layers present; the speed of the compaction increases towards the center of the basin,
to an average of 5 mm per century.
• Isostatic movement; due to loading caused by filling of the basin with sediment, growing and melting
glaciers and a changing sea level, the isostatic movement centers on the basin as well and causes a subsi-
dence rate of on average 15 mm per century during this period.
• Local tectonic movement; faults in the Roer Valley graben cause a subsidence of on average 6 mm per
century in the Roer Valley graben and the western part of the Netherlands while the southern and eastern
parts of the Netherlands rise with an average of 2 mm per century.
These three processes combined, caused a complex combination of marine, fluvial and coastal depositions of
sediment (de Mulder et al., 2003).
The height of the sea level has significant effects on the position of the coastline. However it is far from
the only determining factor, since tectonic movement, change in volume or location of rivers and changes in the
sediment brought by these rivers can affect the process as well. The effect of different factors is hard to identify.
Which process is dominant depends on the time scale. When considering a timescale of tens of millions of years
the dominant factor determining the size of the oceans is plate tectonics, causing a change in the order of 300
- 500 meter (Haq et al., 1987), while on a scale of 100.000 years the amount of land ice is the more dominant
factor. Besides these two, the mechanisms mentioned earlier have an influence as well (compaction, isostatic
movement and local tectonic movement). Therefore it is more common to use the relative change in sea level,
which can be used to mean land or sea changes.
One of the most renowned characteristic of the Quaternary is the relative rapid succession of glacial and
interglacial periods. During the glacial periods the rivers transport relatively coarse materials and the wind
moves large amounts of fine sand due to a lack of vegetation. The subsurface is also influenced by permafrost
which partially thaws in the summer and freezes in winter, causing cryoturbation. During the interglacial periods
the climate is similar to the current climate. Since a glacial period lasts for about 80.000 to 90.000 years and an
interglacial periods lasts for about 10.000 to 20.000 years, it is more often cold than warm in the Netherlands
during the Quaternary.
To summarize; a change in any of the above described factors influenced the deposition processes and cir-
cumstances causing a complex mixture of marine, fluvial and coastal sediments in the North-Western part of the
Netherlands.

2.2. Risks
A brief overview of the most important risks related to HDD projects are presented here. A complete overview
would be too extensive to present here. The risks are divided into specific to the project and risks related to HDD.

2.2.1. Project Risks


The risks presented in table 2.2 are a selection from the risk identified in the initial research (Nugroho and van
Meerten, 2015), this selection is elaborated upon for this research. One of the risks is further elaborated on after
the table.
2.2. Risks 7

Table 2.2: An expanded selection of the risks identified in the initial research (Nugroho and van Meerten, 2015). The depths
are two of the three originally proposed depths, the other being NAP-45m. The pilot drillings are executed at
NAP-65m and NAP-85m.

Depth Risk Evaluation


NAP-65m Part of the drilling path goes through the At higher concentrations gravel or cobbles
valley fill, the composition of which is un- the drilling should be relocated to another
known. There is a risk of encountering path. The chance of encountering high
gravel and larger rocks. At high concen- concentrations is difficult to estimate.
trations of gravel and cobbles the drilling
could get stuck or the pulling through of
the product pipe could be prevented or en-
counter additional problems. Even a sin-
gle boulder could prevent the drilling from
succeeding.
NAP-100m At larger depths more formations of coarse If coarse sand and gravel layers are en-
sand exist. Due to the possibility of con- countered over large lengths the risk of
fined gravel layers in coarse sand there is having to abort the drilling is great. Due
a risk of loss of return flow and a risk of to the length and the limited soil investiga-
deterioration of the drilling fluid. Both tion the risks are high.
processes can lead to borehole instability,
which can lead to failure.
Encountering Pot clay is encountered in Texel in the on- The risk of encountering thick pot clay lay-
Pot Clay shore SIs but it is not identified in the seis- ers is not large. For small lengths the Pot
mic survey of the Marsdiep. When encoun- Clay can be drilled through but if the Pot
tered the Pot Clay can cause problems such Clay is encountered at the horizontal depth
as; additional friction to getting the Drill- another depth free of Pot Clay has to be se-
string (DS) stuck, both due to the swelling lected.
capacity. It can also cause problem with
regards to the progress due to its strength
is may take a lot of time but it can also
cause the drill bit to deviate from the pro-
posed path leading to additional friction on
the DS and making the installation of the
pipeline more difficult.

Pot Clay
Pot Clay refers to the Nieuwolda section of the Peelo Formation. The formation is deposited during an ice age
and compressed by subsequent ice age. This formation is often present in deep incised valleys which can reach
a depth of hundreds of meters. The Pot Clay encountered in Texel is assumed to be the edge of such an incised
valley with orientation west-east and the valley further to the north. The clay of the Nieuwolda section is very
compact and is strong to very strong. It has a light to dark gray, brownish black to black color and can contain
chalk, micas and can be weak to moderately silty or sandy. The clay is glaciolacustrine deposit, which means
that it is deposited by meltwater at the edges of glaciers. The strength of the clay stems from subsidence of the
water-rich clay and compaction by a glacier during the Saale Glaciation.

2.2.2. General Risks


Two of the main risks related to HDD in general are elaborated on in this section, these are borehole instability
and seepage.

Borehole Instability
Borehole instability can influence a project in multiple ways depending both on the length of the instability and
the severity of the instability, ie. the amount of additional soil that enters the borehole. The severity ranges
from ’raining in’ to total collapse of the borehole which results in damaged or loss of equipment. ’Raining in’ is
when well sorted soils are insufficiently supported by the drilling fluid and no interlocking occurs causing a slow
8 2. Literature Review

‘raining in’ of grains into the drilling fluid. If the amount of additional soil does not exceed the transport capacity
this won’t lead to total hole collapse. The following causes for borehole instability are identified (Kruse, 2009):
• Loosely packed granular soils.
• The presence of very permeable gravel layers, no mud crust and or mud cake is formed and thus the walls
are not stabilized.
• High groundwater pressure, for example in an aquifer.
• Groundwater flow.
• Extreme low strength of the layers.
• Chemical reaction of the drilling fluid with the groundwater, causing for example the drilling fluid to
flocculate.
• Chemical reaction of the drilling fluid with the soil.

Seepage
This term covers multiple processes and risks, it can be used to describes events ranging from blow outs to the
surface to leakage of groundwater into the borehole. The following causes for seepage are identified in (Kruse,
2009):
• A high hydraulic head in an aquifer, which exceeds the static downward pressure of the drilling fluid.
• Reduction of the density of the drilling fluid during the drilling phases.
• Excavations at the entry or exit point for the tie-in weld of the pipeline.
• Chemical reaction of drilling fluid with ground water.
• External caused of high groundwater pressure such as pipeline damage.

2.3. HDD
This section is subdivided into the History of HDD (research), and the HDD Process, with a focus on the Pilot
Phase, since that phase is where this thesis focuses on. In appendix C.2 a brief, general section can be found on
equipment used in HDD.

2.3.1. History of HDD (research)


Since its appearance in the Netherlands, HDD and other trenchless technologies have proved their usefulness
and advantages over traditional methods that make use of a trench. This led to the creation of a number of
initiatives to improve the knowledge about these techniques in the Netherlands, funded by the industry alone or
with (partial) funding from the government. This is partially due to the fact that there is a knowledge gap with
respect to applicability in weak soils, which are characteristic for the Netherlands(Arends, 1998).
The two main research programs conducted in the Netherlands, both consisting of a multitude of separate research
projects and lasting multiple years, are;
• Boren van Tunnels en Leidingen. Translated into English; drilling tunnels and pipelines. (BTL), which
translates to Drilling Tunnels and Pipelines. Conducted during the 1990s.
• Gezamelijk Basisonderzoek Boortechnieken. Translated into English it is; joint fundamental research
drilling techniques. (GBB), which translates to ‘Collective fundamental research drilling techniques’. It is
partially based upon the BTL reports as well as a continuation of the BTL research. It is conducted in the
first few years of the 2000s.
Afterwards no fundamental research, on this scale, has taken place in the Netherlands. HDD is a growing market
outside of the Netherlands as well. For example in Canada and the USA its use is increasing as well. Canada and
the USA are facing a growing problem in rehabilitating and replacing their decaying underground utility systems
causing an increase in the demand for technologies such as HDD (Zayed and Mahmoud, 2013).

2.3.2. The HDD Process


The general, idealized drilling process can be described as follows; pressure and pressurized drilling fluid are
delivered to the drill bit from the drilling rig at the surface. The pressurized drilling fluid flows through the drill
bit, infiltrating and excavating the soil. The pressure from the drilling rig causes the drill bit to move forward.
The drilling fluid forms a mud crust (located in the formation) and a mud cake (located in the borehole). This
also happens in front of the drill bit so that the groundwater is partially replaced by drilling fluid in the soil soon
to be excavated. The crust and cake prevent intrusion of significant volumes of groundwater in the drilling fluid.
2.3. HDD 9

The crust and the cake also strengthen the wall of the borehole, increasing the borehole stability. The drilling
fluid transports the drilled soil to the surface where the fluid is recycled and pumped down again. In reality the
process is less simple due to a number of reasons and processes, for example the flow is not continuous due to
connection of new drill pipes at the surface.

Phases
The HDD process can be divided into different phases: pilot, reaming and pull in phase (Kruse, 2009; Denekamp
et al., 2000).

Pilot Phase
During this phase an initial hole is drilled from location A (entry point in figure 2.2a) to location B (exit point
in figure 2.2a). Behind the drill bit a steering tool is located in a non-magnetic part of the drill string, which
monitors the location and progress of the drill bit. In some cases, at or near the surface, a casing can be used. A
casing can be used to prevent blow out, erosion of the borehole and to prevent deviation from the planned drill
path through weak soils. The drill fluid flows back to the surface, between the drill string and the soil.

In some cases when the length of the drilling becomes too long the pilot boring is started from both sides, this
is called the intersect or meeting in the middle method. What is considered too long, depends on the project.
But in the Marsdiep project, where the intersect method is going to be applied, the reason is that the drilling
fluid pressure that is required to ensure proper borehole cleaning, would exceed the limit put on the drilling fluid
pressure with regard to blowout prevention.

Reaming Phase
During this phase the diameter of the borehole is increased in one or more steps to fit the final product pipe or
conduit, see figure 2.2b. To increase the borehole a reamer is pulled from location B to location A. During this
phase the drill fluid can flow to either or both sides of the borehole.

Pull In Phase
During this phase the pipe or conduit is pulled through from location B to location A. A reamer is pulled through
followed by a the pipe with a swivel in between to prevent torque, from the rotation of the drill string, on the pipe
or conduit, see figure 2.2c.
10 2. Literature Review

(a) Illustration of the Pilot Boring Phase.

(b) Illustration of the Reaming Phase.

(c) Illustration of the Pull In Phase.

Figure 2.2: The different phases of a HDD project (Kruse, 2009)

Drill Mechanisms and Techniques


HDD makes use of two drilling mechanisms. One is a jet bit which cuts using the drilling fluids flowing through
nozzles, which is mainly used in soft soils. The other one is a downhole mud motor which is used in stronger
soils (Royal et al., 2010). The mud motor is powered by the flow of the drilling fluid. The introduction of a drill
bit that can rotate separately from the drill string has led to two drilling techniques; drilling (or rotary drilling)
and sliding (or slide drilling). Where rotary drilling enables drilling straight and sliding enables the construction
of turns, see Figure 2.3, (Royal et al., 2010). Both techniques can be used with a jet bit or a mud motor.

Figure 2.3: Illustration of rotary drilling and sliding, resulting in respectively a straight borehole and a turn (Royal et al.,
2010).
2.3. HDD 11

Position determination
Different methods can be used to determine the position of the drill head, depending on the local situation and
project. For example a commonly used method is the Walkover method. This uses a sonde, after the drill bit, that
sends an electro-magnetic signal to a hand held receiver on surface. This method is only suitable at limited depth
(<10 m) and the surface has to be free of steel structures. In both Texel and Den Helder a Gyro Steering Tool is
used. Advantages of the gyro method are (Brownline B.V., 2010):
• No disturbances due to magnetic interference.
• No access on surface required.
• No restriction in built-up areas.
• No limits on drill depth.
• Continuous measurements.
• Real time mud pressure in borehole.
To get the data on the surface initially a mudpulse is used in Texel. This device sends pressure pulses through the
drilling fluid to the surface which can be translated to data. Later the data transfer is switched to a cable within
the Drillstring (DS), see section 4.2.2 for the reasons behind this decision. Due to the cable being present in the
flow inside the DS, it can be damaged by the fluid. This caused delays in Texel since the equipment has to be
pulled back to replace the cable. In Den Helder data are transferred through a wire in the DS which in this case
caused no delays due to pulling the DS back for repairs.

Drilling Fluids
The drilling fluid often consists of a mixture of water with bentonite and/or polymers. Bentonite is a natural
occurring clay mineral (mostly montmorillinite), which, when mixed with water, can be used as a carrier fluid.
Different polymers can be added to create a fluid with exact specifications. Mixing drilling fluid becomes increas-
ingly difficult as different polymers are added since the polymers affect more than one property of the drilling
fluid. It is crucial to have a drilling fluid suitable for the project because of the following functions (Ariaratnam,
2001; Ariaratnam et al., 2007):
1. Transporting the drilled soil to the surface by suspending and carrying it in the flow.
2. Stabilizing the borehole, by creating a non- or low permeable mud cake or crust, the drilling fluid also
exerts a hydrostatic pressure on the surroundings. The combination prevents leakage into the borehole of
groundwater and prevents borehole collapse.
3. Keeping the drilling bit clean as well as cooling the equipment.
4. Lubricating the equipment and reducing the friction between the drill string and the wall of the borehole.
5. When a mud motor is used the fluid flow is powering the mud motor.
The most important factors in deciding what drilling fluid is to be used are the specific conditions at the project
site, so this has to be investigated properly. As is presented above point 3, 4 and 5 are site independent and almost
any fluid will fulfill these functions. Site conditions covers both the soil present as well as the groundwater
present, for example pH and salt content, since salt can cause the bentonite to flocculate and lead to a change in
the properties of the drilling fluid. The material which is used as a basis in Texel is an OCMA (a quality mark)
bentonite. In Den Helder, Teqgel (a mixture of bentonite and polymers in order to guarantee certain properties)
is used.

Advantages
HDD is a trenchless technique, which has advantages over more traditional trench technology, especially with
regards to the social costs, ie. disturbances of any kind, since it can be constructed more quickly, requires
less working space and can be used without disruption to the surface activities (traffic and pedestrian areas)
(Ariaratnam, 2001). In densely populated areas, such as the Netherlands, these advantages become extremely
significant.

HDD has some advantages when comparing it with other trenchless technologies as well. Examples are:
• No vertical shafts required, HDD operates from surface to surface.
• Relative short setup and installation time.
• Flexibility in the borehole alignment and thus the ability to evade obstacles. For example existing conduits
and pipelines.
• A longer installation length than achievable with other techniques in one drive (Allouche et al., 2003) as
cited in (Zayed and Mahmoud, 2013).
12 2. Literature Review

2.4. Comparison of HDD with Directional Drilling (DD)


The differences between HDD and Directional Drilling (DD) in the petroleum industry make a comparison
difficult but since the amount of research conducted in the petroleum industry with regards to DD dwarfs the
amount of research done within the HDD industry (Baumert et al., 2005), it is worthwhile to look into it, to see
whether it applies or not.
For example the flow velocity is a factor which is significantly different; in HDD it is a low velocity laminar flow
which causes little or no erosion to the borehole walls. In DD the flow velocity is much higher and heavier fluids
are used, resulting in a turbulent flow. This is possible due to the difference in geology, such speeds and volume
would erode weak and loosely packed soil and cause instability in the borehole but in rock or within a casing this
is feasible. Due to the depth the pressures and temperatures are different as well, resulting in different downhole
behavior of the drilling fluid. The differences extent beyond the physics and dimensions. For example, there is a
difference in definitions as well. In the Marsdiep project the maximum angle of inclination of the borehole with
the horizontal is about 12 degrees where as a major part in directional drilling is much steeper. This results in
a different definition for the angle of inclination; the angle between the boring and the horizontal in HDD and
the angle with the vertical in DD. This varies between companies as well, the angle of inclination is differently
defined by the surveyors used in Texel and Den Helder.
3
Marsdiep Project
The current pipeline is constructed in a shallow trench in the seabed and crosses a tidal gully. It is subject to
scour and less erosive processes that all result in considerable maintenance costs. This is one of the reasons the
proposed construction method for the new pipeline(s) is Horizontal Directional Drilling (HDD). If HDD is used
for this project it will be one of, if not, the longest pipeline built using this technique to date.
Deltares has been hired to investigate the feasibility of the project and give advice on the most feasible depth
and diameter of the pipe. This includes soil investigations but also being present when the pilot drillings are
executed, taking samples and evaluating the results afterwards.
In this chapter the characteristics of the Marsdiep project are presented, both the results of the preliminary
design calculations as well as the Site Investigations (SIs) conducted (Mesdag et al., 2014; Nugroho and van
Meerten, 2015; Post, 2015).

3.1. Locations and Dimensions


In this section the locations and dimension of the proposed alignments as well as the executed initial SIs are
presented.

3.1.1. Initial Cross-section


The initial cross-section is presented in figure 3.1. This cross-section is based on the results of the initial SIs.

Figure 3.1: Cross-section generated in the program DGEOpipeline, based on the results of Cone Penetration Tests (CPTs) and
a seismic survey (Nugroho and van Meerten, 2015), with Texel on the left and Den Helder on the right side. The
‘_t’ and ‘_d’ in the figure correspond to identified in respectively Texel and Den Helder. In table 2.1 and table A.2
the abbreviations are elaborated on.

13
14 3. Marsdiep Project

3.1.2. Site Investigations


In both Texel and Den Helder onshore SIs are conducted. The initial SI consists of boreholes and CPTs. The
positions of which is presented in figure 3.2 and the coordinates and more information with regards to the initial
SI can be found in appendix B.1. Figure 3.3 shows the results derived from the seismic offshore survey and
figure 3.1 shows the resulting cross-section based on the seismic survey as well as the CPTs. This cross-section
is also used in the calculations. The soil parameters used for the calculations are derived using the CPT and
borehole data as well as the NEN 997-1 table 2b. These parameters can be found in appendix ??.

Figure 3.2: The locations of the conducted onshore SIs, Den Helder (left) and Texel (right) (Nugroho and van Meerten, 2015).
The locations marked with a ‘B’ are the boreholes and those marked with ‘DKMP’ are CPT data points.
3.1. Locations and Dimensions
15
Figure 3.3: The cross-section as a result of the seismic survey (Mesdag et al., 2014).
16 3. Marsdiep Project

3.2. Calculations
Making use of, amongst others, the program DGeoPipeline and the cross-section presented in figure 3.1 a number
of preliminary calculations are made during the initial research into the feasibility of the project. The calculations
range from required pressures and limits with regards to fracturing and blowout to required push and pull forces.
Only the results of those calculations relevant for the pilot drilling are presented in appendix B.

3.3. Alignment
In figure 3.4 the alignment of the planned pilot drillings is presented. The pilot drilling alignment is close to but
does not cross the proposed alignments for the pipeline. This reduces the risk of interaction between the new
and old boreholes, which can cause unpredictable problems but the encountered soil during the pilot drillings is
similar to the soil during the construction of the pipeline.

Figure 3.4: The alignment of the Marsdiep project (Post, 2015).


4
Pilot Drilling Descriptions
In this chapter the details of the pilot drillings are discussed. The source of the information is, in most cases
a report about the setup of the pilot drillings (Post, 2015). Information regarding the execution of the plan is
gathered on site during the pilot drillings.
The primary goal of the pilot drillings is to determine the feasibility of construction of a pipeline between
Texel and Den Helder using Horizontal Directional Drilling (HDD), despite the lack of specific data about the
local geology and properties of the layers. A secondary goal is to gain knowledge and experience that will
help with the design and execution of the realization of the pipeline through the use of the HDD method. The
information required for the definitive design is gathered efficiently at location with the pilot drillings. The final
design will implement necessary measures to reduce the risks identified during the tests. The main contractors
for Texel and Den Helder are respectively A.Hak-Drillcon, a Dutch company and LMR, a German company.

4.1. Site Setup and Data Acquisition


In figure 4.1a and figure 4.1b the site setup of respectively Texel and Den Helder are depicted in a schematic
way. Included are the in- and output of the different parts, which can vary in time. For example the input at the
mixing unit is highly variable depending on the soil, groundwater, efficiency of the recycling unit etc.

An attempt is made to construct a fitting mass balance but this is hindered by numerous processes and missing
information. The data available for this purpose are manual read outs of flow meters on the pipes of the in- and
outflow. The outflow is measured on a pipe coming from the mud pit. The fluid level in the mud pit below the
casing varied. This caused a difference that is in the order of or larger than the losses occurring. This causes the
calculated loss to be negative at times. A negative loss would mean leakage from the surrounding groundwater
into the borehole. No evidence of this is found in the properties of the mud coming out of the borehole, neither
loss of properties due to dilution or abnormal increase in salt content, measured indirectly through the electro
conductivity. A small constant increase is present due to salt groundwater in the drilled soil, that is not filtered
out during recycling so the salinity of the inflow slowly increases.

An overview of the supplied data is inconvenienced by the amount of different sources, parameters, definitions
and formats used. Coupled with the different measuring frequencies and a difference in time between the sources
of data this can cause apparent contradictions and uncertainties. For both locations the supplied data can be
divided into 4 sources:
• The ProData system; All data are measured at the surface and most of it on the hydraulics of the rig. Mea-
surements are automated and this resulted in data, with a frequency of once every 3 seconds, concerning
carriage speed and position (the part of the drilling rig that pushes on the Drillstring (DS)), pull and push,
torque in both directions, rotation speed, pump pressure and pump rate.
• Survey data; acquired by multiple different companies and in one drilling by the drill company. The
supplied data sets vary by company but the majority is the same and consists of data, once every forward
going pipe of the DS, about the location of the drill head and the number of pipes (joint number).
• Driller log data; delivered by the driller. These data also contain the joint number and it is a continuous
data set, so when pulling back, the joint number is recorded as well. Furthermore for every joint the push
and pull, torque in both directions, drill time, rotation speed, pump rate and pump pressure are recorded.
The main difference with the Survey data is that tripping back is included in the driller data sets. The main
difference with the ProData system is that the data are estimations by the driller.
• Drill Company data; delivered by the drill company it contains a wide range of data with a varying degree
of usefulness, due to irregular or insufficient measuring frequency. It contains among others mud data,
photos and technical information of the used (drilling) equipment and data on the usage of materials.

17
18 4. Pilot Drilling Descriptions

(a) A flowchart of the site setup during the drilling in Texel.

(b) A flowchart of the site setup during the drilling in Den Helder.

Figure 4.1: Site setups.


4.2. Description of the Pilot Drillings 19

4.2. Description of the Pilot Drillings


An overview of the realized drilled paths can be found in figure 4.2 and in table 4.1 the planned and realized paths
is presented. Below the different alignments are explained as executed, the proposals can be found in appendix B.
The horizontal alignment is presented in figure 3.4 and is exemplified in section 3.3.

Figure 4.2: Cross-section with the realized drill paths, with Texel of the left and Den Helder on the right side.

Table 4.1: A summary of the pilot drillings.

Planned Realized
Location Code Length [m] Depth [mNAP] Approximate Approximate
Length [m] Depth [mNAP]
PB1T-B 2500 -65 1700 -70
Texel
PB1T-C1 1500 -85 1500 -85
PB1DH-A1 1000 -65 1000 -65
Den Helder
PB1DH-A3 2000 -85 2000 -85

4.2.1. Tests
Two types of tests are used to determine different aspects of the drilling processes. To determine the gel-strength
of the drilling fluid and the stability of the borehole a stop test is done and to determine the average diameter of
the borehole a pill test is done.

Stop Test
The stop test is performed once in Texel and twice in Den Helder. It is executed after reaching the agreed end of
the drilling. The drilling is paused for a number of days and afterwards the conditions in the borehole are tested
to see what the effect of a stop is on borehole stability. When starting after the stop, the pumps are started first to
check if the return flow would start and to test the gel-strength of the drilling fluid. If the pressure generated by
the start of the pumps is insufficient to break the gel-strength of the fluid there are no returns. If this happens the
Drillstring (DS) is rotated to break the gel-strength of the drilling fluid. The order of starting is the opposite of
normal practice after a break. The start of the pumps before rotation of the DS causes increased annular pressure
with an increased risk of fracturing or blowouts. The stability of the borehole is determined while pulling the
drill back to the surface from the build-up of the required pulling force.
20 4. Pilot Drilling Descriptions

Pill Test
This test is performed twice in Den Helder. After a certain volume, a pill of a more viscous fluid is pumped down,
regular drilling fluid is pumped again. The time till the more viscous fluid reaches the surface is monitored so
the average diameter of the borehole can be calculated. The regular fluid is pumped down to prevent distortion
of the results of the stop test (since it would deviate from the reality), which is done after the pill test.

4.2.2. Texel
This project is different than regular projects in the HDD industry and this allowed the contractor in Texel to take
a different approach as well. A mud pulse is initially used to send the data from the drill bit to the surface, see
appendix C.2.1 for more information. After a few days filled with startup issues related to this and other systems
provided by a subcontractor, the company is replaced. The company responsible for the mud pulse system had a
gamma ray device installed which is to be read out at the end as well.
The PB1T-B drilling is executed first at a depth of between NAP-65m and NAP-70m, followed by the PB1T-
C1 Drilling at a depth of NAP-85m. The drillings are executed in shifts, 24 hours a day.
The drilling fluid is created using OCMA-grade Bentonite.

PB1T-B
Due to difficulties in steering in the layer with a jet bit, the first attempt build up a lot of friction and had to be
aborted at about 837m. A second attempt is made at another depth. In order to accomplish this without additional
friction the DS is pulled back to the corner before continuing forward while letting the jet bit fall down until a
more stable layer is reached. This creates one corner with a different radius than proposed, see figure 4.2 but did
not cause a significant increase of the friction on the DS. The new depth is around NAP-70m and the drilling is
aborted after about 1700m, 178 joints, of the proposed 2000m have been drilled. Drilling further is not possible
according to the contractor (van Meerten and Nugroho, 2015). In table 4.2 the observations from the drillers is
presented around that length. Due to the aborted end a stop test is not executed.

Table 4.2: Observations from the driller, joint 176 is approximately 1690m and joint 178 is approximately 1710m (van
Meerten and Nugroho, 2015).

Date Time Joint Activities and Observations


21:08 176 Loss, visual estimate 50%.
26-Jul
23:30 176 Tripping back in order to try and restore return flow.
03:13 166 High torque and pull during tripping back. When rotating and pushing an in-
crease in return flow is observed.
07:00 176 Back at face.
10:16 167 1 mm diameter sand on sieve, inflow is too thin.
27-Jul
10:35 169 Back flow observed.
11:35 176 Back flow stops, less progress afterwards.
13:44 Dilution of inflow visible in return flow. High torque.
15:41 177 Disturbances in data transfer, tripping back to joint 139 (bleeder sub).
19:00 140 Tripping in.
00:00 176 On face, driller requests Barazan to counter the loss of fluid.
00:30 Inflow 1200 L/min, for 2 hours.
28-Jul 02:30 178 No progress, loss, visual estima 75%.
04:00 178 Bentonite supply exhausted, loss of communication.
05:00 178 Tripping back to surface.

PB1T-C1
This boring is executed according to plan. The drilling encountered a strong clay layer for a length of about 10
drill pipes while still going down. At a length of 1501m and a depth of NAP -85m a stop test is executed, with a
duration of two days.
4.3. Sampling Method 21

4.2.3. Den Helder


In Den Helder both drillings are executed successfully. The PB1DH-A2 drilling is executed first at a depth of
NAP-85m, followed by the PB1DH-A1 drilling at a depth of NAP-65m. Work takes place in 12 hour shift when
drilling with a jet bit and continuously when the mud motor is used. The data from this drilling are reliable and
complete almost as soon as the drilling finished, due to daily delivery of almost all of the data gathered that day.
The drilling fluid created using Teqgel, which is a pre-mix of bentonite and certain additives to enhance the
properties of the mixture.

PB1DH-A2
In Den Helder a bottoms up travel time, the time it takes for fluid from the drill head to reach the surface, is
determined in a pill test at approximately 700m borehole length. The test is conducted while tripping back the
DS, in order to change from a jet bit to the mud motor. The pill test is however not as easy or accurate as
expected in this case, since during the tripping of the DS, large losses of drilling fluid are occurring of which
the exact quantity and location are unknown. At the same time backflow occurred making calculation even more
uncertain. This makes it very difficult or impossible to gain an accurate idea of the travel time due to the inability
to accurately calculate the diameter of the borehole due to the uncertainties with regards to the volume of the
drilling fluid. Another pill test is conducted after the end is reached with the mud motor. During this pill test the
pumping continued unhindered by any other activity and thus the result is much more reliable.
A stop test of 2 days is done after reaching the end at 2000m length and at a depth of NAP -85m. The stop
test went as expected. During tripping back the pull force required is higher than expected. The reason for this is
expected to be a minor hole instability caused by the abnormal high mud pressures compared to normal practice.

PB1DH-A1
This drilling is executed with just a jet bit. A pill test is conducted at the end before the stop test. The stop test is
executed with a duration of approximately 3.5 days after reaching the end at 1000m and a depth of NAP -65m.
The stop test caused no problems at startup afterwards.

4.3. Sampling Method


Samples are taken once every hour and analyzed once every two hours. The samples that are not tested on site
are put in a cooling container and transported to Delft to be tested afterwards if required. The method of sample
taking is with a bucket on a stick through a hole in the casing in Texel, see figure 4.3a and at the end of the casing
in Den Helder, see figure 4.3b. Both methods however resulted in mixing of the drilling fluid at the end. If a
moving bed flow is present in the borehole, no evidence of this is seen at the surface. Although no significant
difference is visible in the flow, samples are taken by gathering fluid from the whole width of the flow.

(a) Sample location in Texel. (b) Sample location in Den Helder.

Figure 4.3: The sample locations in Texel and Den Helder.


22 4. Pilot Drilling Descriptions

4.4. Suitability of HDD for SI


The drillings in both locations resulted in a collection of data. The data from the second location is more useful
and complete due to the lessons learned from the first drilling. However improvements are possible. One of the
main requirements for reliable Site Investigations (SIs) is knowing where the samples are coming from. This can
be calculated using basic formulas and a number of assumptions but tests, such as the pill test, can and should be
used to correct the calculations.
For both companies the pilot drilling is unlike a regular one and the difference in how they handled this is
remarkable. In both cases the amount of data gathered is significantly more than the companies are used to as
well as that the data are studied more closely than the companies are used to. From the results of a regular HDD
project the source location of the samples, as calculated in this research, could be calculated. For example the
pump rates and pump time, as measured by the Prodata system, could be reconstructed using the driller logs,
which are part of a regular HDD project, but it is less accurate that way. The resulting locations would be less
accurate as well and it requires a number of assumptions, for example the diameter of the borehole, for which an
indication is acquired in Den Helder using the pill test, and the loss of drilling fluid.
The difference between theory and practice is substantial. Numerous processes are known to occur but no
information about the significance or the magnitude of these processes is present or used on site. In this line of
work, these data are apparently not always required to successfully complete projects.
5
Processes
In order to be able to calculate the sample source location it is important to know what can happen in the
borehole. First in this chapter is a brief literature overview, followed by suitable fluid models and it ends with
a brief overview of the most important flow and transport processes related to Horizontal Directional Drilling
(HDD) projects. A complete overview would be too extensive so a selection is made that focuses on processes
influencing the flow and the transport capacity in the pilot phase.

5.1. Literature Overview


Presenting a brief overview of what processes take place in the borehole is complex, since there are multiple
approaches to find the answer to what happens in the borehole and why: some papers describe two fluid phases
(Espinosa-Paredes et al., 2007; Ofei et al., 2014; Sun et al., 2014), some include three fluid phases (Kelessidis and
Bandelis, 2004; Duan et al., 2008; Ozbayoglu et al., 2009). There are approaches taking the angle of the borehole
into account and one such approach identifies 7 different flow and transport mechanisms (Ramadan et al., 2005)
and there is an approach that divides the borehole trajectory in 3 in addition to 3 fluids in the borehole (Cheng
and Wang, 2008).
What rheologic model is best suited to describe the fluid behavior is a question with no definitive answer yet.
Many drilling fluids exhibit both yield stress and shear-thinning behavior. To reproduce these effects a three-
parameter rheology model is required. The three parameters are: yield stress, consistency index and flow index.
An evaluation is made between models that are used in the drilling industry: Robertson-Stiff, Collins-Graves,
Herschel-Bulkley (HB) and a range of other models by (Weir and Bailey, 1996; Bailey and Weir, 1998) as cited
in (Gjerstad and Time, 2014). In more recent times however the HB model is more used and described by among
others (Talmon and Huisman, 2005) but it is also recommended by the American Petroleum Institute (API) (API,
2010) as quoted in (Gjerstad and Time, 2014). But more complex models are used as well, for example (Zhou
et al., 2013) proposes a 4 parameter model, depending on yield stress, 2 viscosity indexes and a flow index.
The amount of research conducted shows that a solution is still not found, while the amount of research
conducted in the petroleum industry with regards to Directional Drilling (DD) dwarfs the amount of research
conducted within the HDD industry (Baumert et al., 2005). What is making a comparison difficult is that the
definitions (ie. inclination or depth) and specifics (ie. temperature or pressure) are often so different that it is not
applicable in the other research field. The specifics are not always as well reported as is preferable and therefore
it remains unclear whether certain research can be used.

5.2. Different Fluid Models


One of the main factors that determine whether a HDD project succeeds, is the selection of a proper drilling fluid
and its behavior in the borehole and related to that, the transport capacity of the fluid. In order to identify the
behavior of the fluid a description model has to be selected first.

A model often used to describe the rheology of the drilling fluid in HDD is the Bingham Plastic Model (Baumert
et al., 2005), which can be written in the following way:

τ = τy + µ ∗ γ (5.1)

where: τ = the shear stress in [P a]


τ y = the yield stress in [P a], which for a Bingham (BH) fluid is equal to the yield point, YP
µ = the plastic viscosity in [P a.s], for BH fluids also written as PV
γ = the shear rate in [1/s]

23
24 5. Processes

The Power Law rheological model assumes no yield stress and as such the shear stress is defined by:

τ = K (γ)n (5.2)

Where K is the flow consistency index [P a.s n ] and n is the flow index [−]. But while the model is sufficient with
high shear rates it is not as accurate for low shear rates (Hemphill et al., 1993) as cited in (Baumert et al., 2005).

The Hershel-Bulkley or yield-power law model, is a modified version of the Power Law rheological model and
is defined by:
τ = τ y + K (γ)n (5.3)

Most drilling fluids show behavior that can not be accurately described by the Bingham model for fluids. While
the model is sufficiently accurate in the higher shear rate range (300-600 rpm) it is often inaccurate in the lower
shear rate ranges, see figure 5.1, which are of interest for laminar, annular flow behavior (Baumert et al., 2005).
The actual shear rate can be a criterion on which a selection is made between the mentioned fluid models. The
average shear rate in an annulus can be calculated using the following formula from (Denekamp et al., 2000).
8 ∗ vr f
γr f = R f ac ∗ (5.4)
DB H
where: γr f = the average shear rate of the return flow in [1/s]
R f ac = a factor for the hydrauluc radius, which is 1.5 for an annulus
v r f = the average velocity in [m/s]
D B H = the diameter of the borehole in [m]

Another formula for the average shear rate in an annulus is (Mendes and Naccache, 2005):
vr f
γr f = (5.5)
(Ro − Ri )
Where Ro is the radius of the borehole in [m] and Ri is the radius of the Drillstring (DS) in [m].

5.2.1. Determination of Bingham Parameters


The values for the Bingham parameters are derived from the viscometer results as follows:
(RO 600RP M − RO 300RP M ) ∗ C F 1
µ= (5.6)
(600 − 300) ∗ C F 2

where: RO 600RP M = the value of the viscometer at 600 Rotations Per Minute (RPM) [◦ ]
RO 300RP M = the value of the viscometer at 300 RPM [◦ ]
CF1 = a conversion factor used for converting the readout value from [◦ ] to [mPa]
CF2 = a conversion factor used for converting the setting of the device to shear rate, [-] to [1/s]

CF1 and (600 − 300) ∗C F 2 are roughly the same value, respectively 511 and 510, so just RO 600RP M − RO 300RP M
could be used without causing a large deviation. The Y P is calculated as follows:

Y P = RO 300RP M − ((RO 600RP M − RO 300RP M ) ∗ C F 1) (5.7)


Only if the plastic viscosity is a constant the yield point, Y P , is equal to the yield stress, τ y .

5.2.2. Determination of Herschel-Bulkley Parameters


Multiple methods to determine the parameters of the HB model exist. Two methods are discussed.

The Klotz and Brigham Method (Klotz and Brigham, 1998) that uses w i as a weighting factor to account for
the fact that the data gained at high speeds is more precise and reliable than the low-speed data. This method is
meant to be used on data acquired with a 6-speed viscometer. The speeds are 3, 6, 100, 200, 300 and 600 RPM,
which have to be multiplied by 1.703 to get the corresponding shear rate.
5.2. Different Fluid Models 25

( )
6 £ 6 £ 6 6 £
w i log γ̇i w i log τi ,d at a − τ y − w i w i log γ̇i log τi ,d at a − τ y
X ¡ ¢¤ X ¡ ¢¤ X X ¡ ¢ ¡ ¢¤
n= ÷
1 1 1 1
( )2 (5.8)
6 £ 6 6 £ ¡ ¢¤2
w i log γ̇i − w i w i log γ̇i
X ¡ ¢¤ X X
1 1 1

And P6 £
w i log τi ,d at a − τ y − n 61 w i log γ̇i
¡ ¢¤ P £ ¡ ¢¤
1
log (K ) = P6 (5.9)
1 (w i )

= a weighting factor τi − τ y
¡ ¢
where: w i
γ̇i = the shear rate [1/s]
τi ,d at a = the shear stress at the shear rate [P a]

τ y is, in this case an initial estimation of the yield stress which through iteration is changed till an acceptable
value is found for ∆ which is used as a measurement of error and is given by:
6 ¡ ¢2
∆= τi ,d at a − τi ,c al c
X
(5.10)
1

Where τi ,c al c is the calculated shear stress at a given shear rate.

The Log Method is a more fundamental method, which is based on rewriting the basic HB model formula,
(Denekamp et al., 2000; Huisman, 1999). When assuming τ y = ψ∗τ3r pm , where ψ is a scaling factor, formula 5.3
can be rewritten to:
¡ ¢n
τ − τy = K γ
(5.11)
log(τ − τ y ) = log(K ) + n log(γ)

Plotting log(τ − τ y ) versus log(γ) results in a linear graph in which log(K ) is given by the intersection between
the graph and the y-axis and n is the slope or gradient of the graph. By varying the ψ -value the parameters can
be fine tuned to find the solution with the smallest deviation from the measured data. Based on experience the
value for ψ often is between 0.8 - 0.9 or 80 - 90% of the τ3r pm (Denekamp et al., 2000).

5.2.3. Comparison Fluid Models and Determination Methods


An example from (Klotz and Brigham, 1998) is used in table 5.1 to compare the different methods and models.
The Klotz and Brigham method, Log Method and Log Method, Scaled are all methods for the HB model. The
Power Law is included since it is mentioned in section 5.2. The deviation, ∆, in the table is calculated using
formula 5.10.
In this case 80% of the stress measured at 3 RPM proved the most accurate (ψ=0.8). The same results are
plotted in figure 5.1 for a clear overview. In the figure it can also be seen where the deviations are the largest. In
the case of the power law for example it is sufficiently accurate at low shear but deviates significantly at higher
shear, the Bingham approach shows the exact opposite. The method for determining the deviation fails to give
an indication of where the method is the most accurate.
Since the scaled variant of the Log Method (Denekamp et al., 2000), is both less complex and more accurate
it is the preferred method in this research.
26 5. Processes

Table 5.1: A table comparing the results and accuracy of different fluid models as well as two methods of acquiring the HB
parameters, the data from mud model 3 from (Klotz and Brigham, 1998) is used.

RPM Dial Reading Klotz and Brigham Log Method Log Method, Scaled
Method (ψ=0.8)
3 14 τy 6.46 τ y = τ3r pm 7.15 τ y = ψ ∗ τ3r pm 5.72
6 16 n 0.552 n 0.686 n 0.522
100 30 K 0.534 K 0.217 K 0.661
200 38 ∆ 1.173 ∆ 4.278 ∆ 0.356
300 44 Bingham Power Law
600 60 YP 14.305 n 0.261
PV 0.016 K 4.454
∆ 94.997 ∆ 105.670

Figure 5.1: Graph based on table 5.1. Showing different models to describe fluid behavior.
5.3. Flow of Drilling Fluids 27

5.3. Flow of Drilling Fluids


The average velocity can be calculated with the following formula, (Baroid, 1997) as cited in (Baumert et al.,
2005):
21.22 ∗ POut put
vr f = (5.12)
(D B2 H − OD DS
2
)

where: v r f = average fluid velocity in the borehole [m/s]


POut put = the pump rate [L/min]
OD DS = the outer diameter of the DS in [mm]

The pressure loss for Bingham fluids can be calculated using the following formulas, where the e f ac t or corrects
for possible eccentricity of the DS, see figure 5.2:
" #
47.88(PV ∗ v r f ) 6∗Y P
d P /d L = 2
+ ∗ e f ac t or
D B H − OD DS (D B H − OD DS )
(5.13)
δ
e f act or =
Ro − Ri

where: d P /d L = pressure drop gradient [kPa/m]


e f ac t or = eccentricity [-]
δ = distance between center of borehole en center of DS [mm]

Figure 5.2: An example of a way to describe the geometry of a borehole with an eccentric DS (Baumert et al., 2005).

The following parameters are defined as characteristic for the flow behavior for a Bingham fluid (Bisschop,
1995):
The Reynolds number for Bingham fluids, which is defined as follows:

ρr f D B H vr f
Re = (5.14)
µ

Where Re is the Reynolds number and ρ r f is the fluid density. In general if Re ≤ 2000 the flow is laminar. A
generalized formula for the Reynolds number (Madlener et al., 2009), which can be applied to different fluid
models is defined as follows:

ρ r f ∗ v r2−n
f
∗ D Bn H
Re g en, f ul l = ´n
τy ¢n D B H n−1
³
∗ DvB H + K ∗ 3m+1 ∗ 8n−1 + µ∞ 3m+1
¡
8 rf 4m 4m ∗ v rf (5.15)
n ∗ K ∗ (8 ∗ v r f /D B H )n + µ∞ ∗ (8 ∗ v r f /D B H )
m=
τ y + K ∗ (8 ∗ v r f /D B H )n + µ∞ ∗ (8 ∗ v r f /D B H )
28 5. Processes

This is based on the viscosity law for an extended version of the HB model, that adds an µ∞ as a term for the
constant viscosity at very high shear rates. The viscosity law for the BH model and the law for the HB model are
different and the formula can be reduced accordingly. The viscosity law for the BH model is:
τy
K = 0, n = 1 → µ = + µ∞ (5.16)
γ

Where µ∞ is constant in the BH model and is equal to the plastic viscosity, PV . The viscosity law for the HB
model is:
τy
µ∞ = 0 → µ = + K γn−1 (5.17)
γ

The Hedstrom number, which is defined as follows:

ρ r f τ y D B2 H
He = (5.18)
µ2

The settling velocity, can be determined in a number of ways. In order for settling to occur, the grain has to
surpass the yield stress. The maximum grain diameter, d , before the yield stress is exceeded can be found using
multiple formulas, according to (Wan and Wang, 1994) as cited in (Bisschop, 1995):
16.5τ y
d= (5.19)
g (ρ s − ρ r f )

And according to (Slater, 1977) as cited in (Bisschop, 1995):


15.4τ y
d= (5.20)
g (ρ s − ρ r f )

Where ρ s is the grain density. Both equation 5.19 and equation 5.20 can be rewritten and are examples of a
criterion originating in the plasticity theory:

τ y ≤ a cr (ρ s − ρ r f )g d (5.21)

Where acr is in a range between 0.048 - 0.200 according to the results in a literature study by (Chhabra, 1993)
as cited in (Talmon and Huisman, 2005). For Bingham fluids the following formula can be used to calculate the
settling velocity (Wan, 1985) as cited in (Bisschop, 1995):

(ρ s − ρ r f )g d 2 7d τ y
v set t l e = − (5.22)
18µ 24µ

This formula is similar to the Stokes equation only contains an additional term. Other formulas found for the
settling speed in a Bingham fluid are often variations on the Stokes formula for laminar flow, for example the
formula for moderate inertial effects presented by (Prashant and Derksen, 2011):

(ρ s − ρ r f )g d 2
v set t l e = p (5.23)
18µ(1 + Re/9.06)2

which is based on:


p
24 Re 2
Cd = (1 + )
Re 9.06
(5.24)
ρ r f Uc L c
Re =
µ

The settling velocity as found in (Talmon and Huisman, 2005) has a slightly different form:
2
1 (ρ s − ρ r f )g d
v set t l e = α (5.25)
18 µ
5.3. Flow of Drilling Fluids 29

where:
τy
µ= + K (γ̇)n−1 (5.26)
γ̇
And α is an empirical coefficient to be determined from laboratory tests, in the paper α = 0.5 is used. The
similarities with earlier formulas are remarkable since (Talmon and Huisman, 2005) consider a Herschel-Bulkley
model instead of Bingham Plastic.

The ratio between yield stress and shear stress due to friction, which is defined as follows:
τy
ξ= (5.27)
τw
Where τw is the shear stress due to friction, which is calculated using:
f
τw = ρ r f v r2 f (5.28)
2
Where f is the Fannings-friction coefficient. Equation 5.27 can be used, for laminar flow, to determine the size
of the plug, for turbulent flow it is assumed that no plug flow occurs.

The Plasticity number, defined as the ratio between Hedstrom and Reynolds:
He 8ξ
PB = = (5.29)
Re 1 − 3 ξ + 31 ξ
4

The relative settling time:


tk
t=
ts
D
tk = (5.30)
2v set t l e
L
ts =
vr f

where: t = relative settling time [-]


t k = average time a grain requires to settle
t s = average time a grain is in the borehole
L = borehole length [m]

If t < 1 settling has to be taken into account.

5.3.1. Infiltration Loss


Infiltration is a complex process but it is necessary to quantify in order to know the quantity of the return flow. In
BTL-34 as cited in (Mastbergen et al., 1998; Denekamp et al., 2000; Mastbergen and Aanen, 2003) the following
formulas can be found:
∆P bh ∗ α ∗ D p
ya =
κ ∗ τy (5.31)
∆Q i l = π ∗ v d r i l l ∗ (n 0 ∗ (D B H ∗ y a + y a2 ) + y c ∗ (D B H − y c ))

where: y a = the infiltration depth


∆P bh = the pressure difference between the borehole and the surrounding groundwater
α = a factor (value 8/75)
Dp = the pore diameter (4/9 ∗ D 15 )
κ = a blockage factor and is 1 for coarse sand/ fine gravel, 2 or 3 for fine sand
∆Q i l = The volume that is lost due to infiltration
vd r i l l = the drill velocity
n0 = the porosity
yc = cake thickness
30 5. Processes

5.4. Transport
Different approaches exist to model the transport processes and the amount of transport processes identified. An
extensive one by (Peden et al., 1990) presents a summary of earlier research:
• Homogeneous Suspension; sand is transported in suspension and distributed uniformly over the annular
space.
• Heterogeneous Suspension, sand is transported in suspension but there is a concentration gradient across
the annulus with more sand in the lower half of the annular space.
• Suspension/Saltation or Saltation/Suspension; sand is still transported in suspension but it is densely
populated near the low-side wall so that it is virtually transported by jumping forward or saltating on the
surface of the low-side wall. If suspension is dominant, this category is termed "Suspension/ Saltation"
and vice versa.
• Sand Clusters; sand is transported in suspension, but is is transported in clusters and all of the sand within
each cluster is traveling with roughly the same velocity.
• Separated Moving Beds (Dunes); separated sand beds are formed on the low-side wall of the annulus.
The sand on the surface travels forward while the sand on the inside of the bed remains stationary, so that
the beds look like they are rolling or sliding forward as a whole.
• Continuous Moving Bed; a thin, continuous sand bed is formed on the low-side wall of the annulus with
the sand near the low side wall rolling or sliding forwards at a lower velocity than that above the bed.
• Stationary Bed; a continuous sand bed is formed on the low-side wall of the annulus with the sand on the
surface of the bed rolling or sliding forward while the sand inside the bed is stationary.
The modeling of cuttings transport is extremely complex and no simple correlations exist for HB fluids (Bern
et al., 2007). Methods recommended to the API with regard to transport in vertical and high-angle wells are
based on Bingham fluids (Bern et al., 2007). For Bingham fluids 4 transport processes are identified (Bisschop,
1995):
• ‘No’ transport; grains are too big or the flow velocity is too low thus no transport occurs, this is referred
to as ‘Flow with stationary bed’ in Figure 5.3a.
• Transport through occurrence of plug-flow.
• Bed transport; transport along the bottom, also called saltation, see Figure 5.3b. The grains have a lower
velocity than the drilling fluid.
• Suspension transport; grains are small enough or the flow velocity and the viscosity are high enough, the
grains are transported as fast as the flow and the grains are evenly divided in the vertical direction, this is
referred to as ‘Flow as homogeneous suspension’ in Figure 5.3a.
5.4. Transport 31

(a) Different transport processes, (Vanoni, 1977) as (b) The saltation process, (van Rijn, 1987) as cited in
cited in (Bisschop, 1995). (Bisschop, 1995).

Figure 5.3: Transport processes

Plugflow
In a moving fluid, with a yield stress, plug flow is assumed to occur. In figure 5.4a the geometry of plug flow is
shown. An equation is given in (Kelessidis et al., 2006) for the τ y as depicted in the figure. This formula can be
rewritten to a function for the plug flow radius as follows:
rp d P
τy =
2 dL
(5.32)
dL
r p = 2τ y
dP
Where r p is the radius of the plug flow.

For plugflow the transport capacity is relatively easy to calculate, with the following formula (Bisschop, 1995):

Φ T p = ξ2 c v (5.33)
where: ΦT p = the transport capacity
ξ = the part where plug flow occurs
c v = the grain concentration

(a) The geometry of plug flow, in a pipe (b) The geometry of plug flow, in a concentric
(Kelessidis et al., 2006). annulus (Kelessidis et al., 2006).

Figure 5.4: Plug flow geometries


32 5. Processes

Bed transport
For the transport in bed transport the formula’s by (Graf, 1984) as cited in (Bisschop, 1995) can be used:

ΦT b = 10.39ψ−2.52
T (5.34)
where:
(ρ s − ρ r f )d
ψT = (5.35)
ρ r f SR h

The concentration which can be transported is:


r
ρ s −ρ r f
ΦT b ρr f gd3
cv = (5.36)
v r f Rh

where: ΦT b = transport capacity bed flow


ψT = normalized shear stress
S = pressure drop
R h = hydraulic radius

Bed transport to Suspension transport transition


Whether a grain is transported by the flow can be described by the following formulas (van Rijn, 1993) as cited
in (Bisschop, 1995):

−1
0.24d ∗

 1 <d ∗ ≤ 4
−0.64

0.14d ∗ 4 <d ∗ ≤ 10



θcr = 0.04d ∗−0.1 10 <d ∗ ≤ 20 (5.37)

0.013d ∗0.29 20 <d ∗ ≤ 150






0.055 d ∗ > 150

where:
τw
θcr = (5.38)
(ρ s − ρ r f )g d

and:
ρ b (ρ s − ρ r f )g
µ ¶1/3
d∗ = d (5.39)
µ2
However the resulting mode of transportation is bed transport, which has a high chance of sand accumulation.
The ideal mode is suspension transport. The following formula, derived in (Hanks, 1980) as cited in (Bisschop,
1995) can be used to calculate the velocity required for suspension transport:

ρ s − ρ r f 1/2 d 0.23
· µ ¶¸ µ ¶
v cr = 1.32c v0.186 2g D (5.40)
ρr f D

An upper limit with regards to concentration, c v , is not presented, although 0.15 - 0.2 is assumed as a safe value.
Since v cr is the lower boundary the left part could be rewritten to v ≥ .... Rewriting that equation results in a
formula for the maximum diameter of a grain for suspension transport based on the fluid velocity.
 h ³ ρ −ρ ´i−1/2 1/0.23
s rf
v r f ∗ 2g D B H ρ
rf
d ≤ DB H ∗  (5.41)
 
1.32c v0.186

Suspension transport
All of the dug soil is transported if the condition of equation 5.40 is fulfilled.
5.5. Lag Time or Source Location 33

5.4.1. Transport Parameter


Another approach to see whether transport will take place can be found in BTL-42 as cited in (Denekamp et al.,
2000). It is based on the grain size and the rheology of the drilling fluid.
3 ∗ τy
Yg = (5.42)
(ρ s − ρ r f ) ∗ g ∗ D 90
Where Y g is the transport parameter and D 90 is the grain size at which 90% of the grains are smaller. Accretion
of sand will take place for Y g < 0.1. This is the theoretical value for which a grain in a non-Newtonian fluid will
no longer settle and the settling speed is 0. There are however other factors that influence the settling speed that
is why a Y g > 2 to 4 is recommended. The formula can be rewritten to:

3 ∗ τy
D 90 = (5.43)
(ρ s − ρ r f ) ∗ g ∗ Y g

which can be used to calculate the maximum diameter that the fluid can transport based on a certain value for the
transport parameter.

Within the scope of this research and the data gathered it is decided not to go into more detail with regards to the
transport processes.

5.5. Lag Time or Source Location


The results of the previous sections can be combined to calculate the lag time or source location. This is necessary
in order to connect the spoils of the return flow to a location in the subsurface. One such approach focuses on the
creation of a Lag Diagram which plots the source location of the cuttings against the current position of the drill
bit and an example is presented in figure 5.5. This approach uses the following assumptions(Garcia-Hernandez
et al., 2008):
• Steady state condition in both flow rate and rate of penetration.
• No changes in the rheological properties of the fluid along the well.
• Circular wellbore geometry.
• No mass transfer between the combined phases and their surroundings.
• No heat transfer between the combined phases and their surroundings.
• No interruption of the drilling process (no connection time).
• Constant cuttings velocity in each segment of the well.
• Constant physical characteristics of cuttings (size, distribution and shape).

The approach also divides the geometry into three parts: vertical, inclined and horizontal. The vertical part is not
discussed in this research since it is not applicable to this project. In equation 5.44 the formulas for the inclined
part are presented.

VT (I ncl .) L I Si n(αV )
S D X (I ncl .) =
VT (I ncl .) + ROP
(5.44)
VT (I ncl .) L I C os(αV )
S DY (I ncl .) =
VT (I ncl .) + ROP

where: S D X (I ncl . = is the x-coordinate on the inclined part


VT (I ncl .) = is the cuttings traveling speed
LI = is the length of the inclined part
αV = is the angle between the inclined part and the vertical
ROP = is the average Rate Of Penetration (ROP)
S DY (I ncl .) = is the y-coordinate on the inclined part
34 5. Processes

In equation 5.45 the formulas for the horizontal part can be found.
VT (Hor.) L H
S D X (Hor.) = (5.45)
VT (Hor.) + ROP
where: S D X (Hor.) = is the x-coordinate on the horizontal part of the boring
VT (Hor.) = is the cuttings traveling speed
LH = is the length of the horizontal part
S DY (Hor.) = is constant

Figure 5.5: An example of a lag diagram, relating the current location of the drill head to the location of the source of the
cuttings, (Garcia-Hernandez et al., 2008). ROP is the drill velocity, VT is velocity of the cuttings and VL is the
fluid velocity.
6
Methodology
In this chapter the methodology of the performed tests is elaborated on. As briefly mentioned in chapter 1 a goal
of this thesis is to investigate if it is possible to connect the spoils of the return flow to a location in the ground.
This is divided into two parts. The methodology of the actual data acquisition and tests performed on samples
from the return fluid is presented first in a section on Equipment and tests. Secondly the programs that connect
the samples to a source location are presented. These programs are explained further on in separate sections in
more detail:
• SampleSource Program, main program, does the calculations.
• MarsdiepVisual Program, creates graphs for visualization of the measurements and the results of the main
program.
• Fixes Program, deals with inconsistencies in the data and makes figures for the report that are not depended
on samples and scenarios, eg. figure 6.1a.

6.1. Equipment and Tests


In this section the equipment and the performed tests are mentioned. For more details see appendix C, which
contains photos and brief explanations of the equipment that is used. Not all of the described equipment is used
in both Texel and Den Helder as well as the laboratory of Deltares.

Table 6.1: A brief overview of the equipment used and the reason why it is used.

Equipment Motivation
Marsh Funnel To get and indication of the viscosity.
Viscometer or Rheometer A six-speed viscometer, to determine the rheological properties.
Mud Balance Determine the density of both inflow and return flow.
Electical Conductivity Meter To get the electrical conductivity, for example an increase in salt content
influences the rheological properties of the drilling fluid.
Sand Content Kit Determine the sand content of the return flow.
Sieve Test (On Site) To get an indication of the returns and to get clean fluid for the rheology
test.
Sieve Test (Laboratory) To determine the coarseness of the returns.
pH meter To get the pH, for example a decrease in pH is often an indication for
the presence of peat.

An adapted sieve test is performed on site, the test is adapted to the limits of the location and the available time.
The test conducted to check visually for changes in the soil and the sieved fluid, is used in determining the
rheology. Sieved fluid is required since the presence of grains can cause additional friction, distorting the results
of the test and cause damage the viscometer. A standardized sieve test is conducted in the laboratory in Delft to
determine the grain size distribution and to identify the formation of the samples.

35
36 6. Methodology

6.2. SampleSource Program


This program does the main calculations. For both drilling sites it can calculate for every sample, amongst others,
the following:

• The location of the samples, based on different scenarios.


• The fluid properties for the Bingham and Herschel-Bulkley model.
• Which of those two models is the best fit to the experimental data.

A concise flowchart of the program can be found in figure 6.2. The full code can be found in appendix E.

6.2.1. Calculation of the Source Location (Intersection Method)


The Intersection Method, created for this research, is used to calculate the source location of the sample. The
method is a fundamental one and appears easy to apply. It is foremost based on the pumped volume and the
location of the drill head. For both sites the pump rate [l /mi n] and pump activity are known at time intervals of
3 seconds. With this and an estimated borehole diameter a length can be calculated, this length is the amount of
space the pumped volume takes in the bored hole. Below the method is elaborated with a simplified example,
the parameters are only used in this example.

Example Calculation
In figure 6.1a a schematic, simplified version is depicted of the Intersection Method with two different diameters
but the same amount of pumped fluids. In figure 6.1b the drill head and fluid head locations are plotted.
At T − 0 the sample is taken and the location of the drill head and the location of the sample are known. At
T −1 the drill head is one pipe less far in the ground. The amount of fluid that is pumped down between T −0 and
T − 1 is calculated and divided by a cross-sectional area of the bored hole. The resulting length is the distance
that the fluid head traveled in this time. Continuing to do this results for the case of Diameter 1 in an exact match
at T − 2. At this point the fluid and the drill head are at the same location, which is expected to be the source
location of the sample.
Since diameter 2 is larger and the fluid rate is the same the distance the fluid head moves within the same time
interval is less. This means, in this case, that the transport time is increased and the distance from the surface to
the source location is decreased. It is also not an exact match.
In table 6.2 the values of the variables that are used in the figure 6.1a is presented.

Table 6.2: Values used in constructing figure 6.1a. T is timestep.

Diameter 1 Diameter 2
Cross-Sectional Area 1 2 m2
Length Borehole 8 m
Drill Rate 1 m/T
Pump Rate 3 m 3 /T
Fluid Head Rate 3 1.5 m/T

Table 6.3: Values used in constructing figure 6.1a.

Location Fluid Head


Location Drill Head
Diameter 1 Diameter 2
T-0 0 0 8
T-1 3 1.5 7
T-2 6 3 6
T-3 9 4.5 5
T-4 12 6 4

As is presented at T-2 the fluid head for diameter 1 and the drill head are located at the same location. Logically
this is the source location of the sample taken. For diameter 2 there is not an exact match. After interpretation it
can be found that at around 5.8m the locations are the same.
6.2. SampleSource Program 37

Complications
There are a number of factors that complicate the method as it is described above. The most important ones are
listed below with a description and how they are handled.

Diameter
The diameter of the bored hole is unknown and although it can be estimated, it is likely highly variable due to
amongst others the variation in the soil, pump rates or progress rate. Due to the scope of this thesis different
diameters are looked at but it is assumed to be the same over the whole length of the borehole, see the next
section. It is however recommended that for further research the influence of diameter on transport processes is
taken into account.

Fluid loss
Unfortunately the fluid loss is also unknown. Despite the measurements taken on site the uncertainties remain
significant. To handle this problem 3 different losses are considered. In reality this parameter will also be location
dependent and it is recommended that it is further investigated to determine its influence. Furthermore, in Den
Helder there is a loss of about 5m 3 in the casing, every night which means that probably the mud cake of a certain
layer relatively close to the surface is not impermeable. For Texel the level of the drilling fluid in the casing is
not checked and reported on, so it is unknown whether a loss occurred during breaks.

Geometry and Flow and Transport Processes


This factor is a combination of interacting processes and uncertainties. The borehole is assumed to be cylindrical
in shape and the location of the Drillstring (DS) will have an influence on the behavior of the fluid down hole
but not much more is definitely known. About the location of the DS downhole there are multiple ideas, ranging
from corkscrew shape, while drilling, to below the borehole.
Another factor is the possibility of a bed forming in the borehole. When assuming a three phase system (from
bottom to top; stable bed, moving bed and fluid) the cross-sectional area through which the fluid can freely flow,
becomes severely limited as well as complex since the fluid might flow through the bed as well at velocities
significantly different from the flow through the top of the borehole. The velocity of the cuttings is in most cases
not equal to the velocity of the fluid, the exception being suspension transport.
For now the cross-section of the borehole is assumed to be circular and the DS is located within the borehole,
ie. the cross-sectional area of the DS is subtracted from the cross-sectional area of the borehole. The other factors
are not taken into account.

The Data or Execution in Practice


This last part relates to both the format of the acquired data as well as to the events that have taken place. The
events range from repairs, blocks of missing data or just errors in the data, pulling back a few pipes when the
system short circuit due to a damaged cable to other events that are not foreseeable but do influence the drilling
process and add to the complexity of the data sets gathered on site. The time scale of the data related to the
pumped volume, once every 3 seconds, is different from the time scale of the data related to the position of the
drill bit, once every DS pipe, approx 10 min. There is not only a difference in frequency but also a difference of
minutes is possible.
Exact matches are rare between the two sets of data. This is solved by taking a deviation in consideration
and looking for the closest approximation. If it is not found the deviation increases and the match is sought again
until a match is found.

6.2.2. Scenarios
In order to deal with the uncertainties with regards to the source location stemming from the uncertainties with re-
gards to the method of transportation and the losses, different scenarios are taken into account. For two variables
three options are investigated to get a range of values and thus to get an idea of the magnitude of uncertainty:

• Loss of drilling fluid; the values are the same for both sites.
– 0%; no loss this is a theoretical upper limit for the volume of the return flow.
– 7%; this value is based on the in- and outflow measurements taken on site. This is an average value
of the overall difference between the cumulative in- and outflow, which are only available for Den
Helder. An attempt is made to reconstruct it for Texel but due to different sources the resulting loss
is negative and thus unrealistic.
38 6. Methodology

– 30%; this is an assumption taken from the contractors and is used as an initial conservative value,
this is used as the lower limit for the volume of the return flow.
• Borehole Diameter; the values are different for both sites. The borehole diameter is related to transport
time since when the diameter goes up the velocity goes down and thus the transport time goes up as well,
which means that the source location becomes closer to the surface.
– 1.1 ∗ D Dr i l l , this is an assumption based on the minimum a drill head removes when passing through
the ground. When it rotates or pauses for moment the diameter will already be bigger. This is a
conservative value and as such the velocities in the borehole are likely to be lower and thus the
transport time longer.
– 0.45m, this is the result from tests conducted with a thicker fluid, a pill, in Den Helder. Such a test is
only done in Den Helder so for Texel 0.4m is assumed since the equipment used in Texel is smaller
than in Den Helder.
– 0.8m, for Den Helder and 0.55m, for Texel. These diameters are based on calculations of the diameter
derived from the measured sand content (Nugroho et al., 2016).

Table 6.4: The different scenarios.

Scenario Diameter Loss


Texel Den Helder [%]
1 0
2 1.1 ∗ Diameter of the Drill 7
3 30
4 0
5 0.40 0.45 7
6 30
7 0
8 0.55 0.80 7
9 30
6.2. SampleSource Program
(a) A simplified version of the Intersection Method.

(b) A graphical representation of the head locations.

Figure 6.1: The Simplified Intersection Method.

39
40 6. Methodology

Figure 6.2: The flowchart for the SourceSample program.


6.3. MarsdiepVisual Program 41

6.3. MarsdiepVisual Program


This program is designed to create results not related to the scenarios and samples or depended on calculated
data, ie. measurements and sieve results. This program consists of multiple parts. A flowchart of the program is
presented in figure 6.3. The full code can be found in appendix F. Parts 1, 2, 4 and 6 visualize results, initial or
created in the SampleSource program. Part 3 deals with the data related to the sieve tests conducted on samples
taken from the initial (vertical) boreholes and those on the samples acquired from the return flow in Texel and
Den Helder during the (horizontal) pilot drillings. Part 5 merges different parameters from all scenarios into 1
file for easier evaluation.
42
6. Methodology
Figure 6.3: The flowchart for the MarsdiepVisual program.
6.4. Fixes Program 43

6.4. Fixes Program


This program consists of multiple parts as well but these are all small programs that only had to run once, when
correctly written.

• ProData file fix: in Texel multiple pumps are present and for a short while a pump is attached that had the
sensors but those are not calibrated or connected so a gap in the mudflow data exists. The gap is filled
using data with a lower accuracy found in the driller logs.
• Gefs: this part reads the desired variables from all 69 gef files containing the sieve results and puts them
in a .csv file. Thus collecting all required information in one file for easier continuation and removing the
unnecessary variables.
• Intersection Method figure: this creates a figure that is used to clarify the Intersection Method, figure 6.1a.
• Fluid Model figure: this creates a figure, figure 5.1, that is used to compare the different fluid models and
the different methods of determining the parameters.
7
Measurements
In this chapter characteristic results of measurements conducted on the project site and in the laboratory tests are
presented.

7.1. Supplied Data


In this section examples of the supplied data are presented. A description of the different types can be found in
section 4.1.

7.1.1. ProData System


In figure 7.1 a screen capture is presented of the resulting data from the ProData system. The system is, besides
calibration, essentially the same in both Texel and Den Helder. From right to left the columns, in figure 7.1 are:
• TS (time stamp) in [days month year hours:minutes:seconds].
• BIT-DPT, this feature is not implemented.
• HOL-DPT, this feature is not implemented.
• CAR-POS (carriage position) in [mm].
• CAR-SPD (carriage speed) in [cm/min].
• PULL (pulling force) in [KN].
• PUSH (pushing force) in [KN].
• TORQ+ (the torque in clockwise direction) in [N.m].
• ROT-SPD (rotation speed) in [Rotations Per Minute (RPM)].
• M-PRESS (pump pressure) in [Bar].
• MudFlw IH (pump rate) in [L/min].
• TORQ- (the torque in anti-clockwise direction) in [N.m].
• PRESS-1, this feature is not implemented.
• PRESS-2, this feature is not implemented.
• PRESS-3, this feature is not implemented.
• HS-D, this feature is not implemented.

45
46 7. Measurements

Figure 7.1: A screen capture of the data supplied by the ProData system.

7.1.2. Survey Data (Drilling Paths)


In figure 7.2 and figure 7.3 screen captures is presented of the survey data from respectively Texel and Den
Helder.
The survey data are, in this research, mainly used to determine the drill location. In figure 7.4 and fig-
ure 7.5, the actual drilled paths in respectively Texel and Den Helder are depicted. With on the axis; Elevation
in [mN AP ], Away, the horizontal distance, in [m] and RC al cul at ed which is the horizontal deviation in [m], with
the positive value being a deviation to the right from the proposed path. The jet bit part of the NAP-85m drilling
in Texel is missing so the beginning of the NAP-85m mud motor bit is used to recreate the drill location for the
jet bit part. The data set used for the graph is used for the calculations but since it is the same, the mud motor
line (green) covers the jet bit line (yellow) in figure 7.4.
The NAP-65m jet bit part in Den Helder is deliberately moved 2 meters to the right in order to create more
distance between the boreholes at different depths. This as a safety measure against fracturing or blow-out to the
other borehole and the loss of circulation that can cause. The horizontal deviation in Texel is about thrice the
deviation in Den Helder.
7.1. Supplied Data 47

Figure 7.2: A screen capture of the survey data from Texel.

Figure 7.3: A screen capture of the survey data from Den Helder.
48
7. Measurements
Figure 7.4: The drilled paths in Texel.
7.1. Supplied Data
49
Figure 7.5: The drilled paths in Den Helder.
50 7. Measurements

7.1.3. Driller Log


In figure 7.6 and figure 7.7 screen captures of the driller logs from respectively Texel and Den Helder is presented.
In this research the data are used to check on the other data sets.

Figure 7.6: A screen capture of the driller log from Texel.

Figure 7.7: A screen capture of the driller log from Den Helder.

7.1.4. Drill Company Data


The drill companies also provided information about the equipment and the tests performed on fluid samples by
them. Due to the frequency, uncertainties about the specifics and the difference in what is tested, the results of
those tests are not taken into consideration for this research.
7.2. Acquired Data 51

7.2. Acquired Data


This section presents the results of the laboratory tests conducted on the samples acquired during the pilot borings
as well as the measurements taken in the laboratory of Deltares in Delft. An overview of the test can be found in
section 6.1 and the tests are elaborated in appendix C.

7.2.1. On site
Here the results are presented of the tests conducted in the on site laboratory in Texel and Den Helder. This will
mainly consist of the results of the rheological tests. A screen capture of a part of the data is shown in figure 7.9.
Results of the sieve test performed on site is presented in figure 7.8. A description of this sample can be found
in table 7.1. Additional observations are that the 0.6mm sieve contained less than the previous sample and that
the 0.212mm and 0.063mm contained less silt-sized grains that had to be washed away after sieving since the silt
grains blocked the flow through the 0.212mm and 0.063mm sieves.

Table 7.1: Descriptions of the sieve results depicted in figure 7.8. The quantity is based on how much of the sieve, area wise,
could be covered with the quantity that is present on the sieve. The sample in the table is PB1DH-A3-85-69.

Sieve Size [mm] Quantity [%] What


5.6 - Pieces of wood
2 - Pieces of wood
1 - Pieces of wood, few sand grains
0.6 <10 Sand (clear)
0.355 <50 Sand (gray)
0.212 <25 Sand (gray)
0.063 <25 Sand (gray)

Figure 7.8: An example of the results from the sieve test conducted on site. The sample in the figure is PB1DH-A3-85-69.
52 7. Measurements

Figure 7.9: A screen capture of data gathered in Texel and Den Helder. This example comes from the Den Helder NAP-65m
drilling. The unit of the viscometer values is degrees.
7.2. Acquired Data 53

7.2.2. Deltares, Delft


A selection is made of the samples taken on site. This selection is made based on head location at sampling time,
to get an even spread along the drilled paths. In the Deltares laboratory in Delft the samples are sieved. The sieve
results are put in a database, which resulted in a standard report and a .gef file per sample. An example of the
standard report is presented in figure 7.10.
54 7. Measurements

Figure 7.10: An example of a report constructed for every sample. The sample in the report is PB1DH-A3-85-69.
8
Interpretation
In this chapter the interpretation and correlation of the measurements and data as described in the previous
chapters as well as the results of the programs are presented.

8.1. Drilling Fluid


In this section the interpretation of results and measurements with relation to the fluid behavior and model are
presented. All samples discussed here are taken from the return flow and a selection is made based on the drill
bit location at sampling time to get an even spread of the fluid samples along the borehole.

8.1.1. Fluid Model


Although the Bingham (BH) model is widely used, it is not always the best model to describe the rheology of
the samples from the return flow. As an alternative the Herschel-Bulkley (HB) model is used. Which of the fluid
models describes the fluid behavior the best is not only dependent on the used base materials for the bentonite
slurry but also on the chemistry of the soil. For example peat, encountered in Den Helder, often lowers the pH,
which lowers the viscosity of the fluid. Additional materials can be added to counteract the decrease in pH,
for example soda ash and fresh bentonite but those materials have an influence on other properties of the fluid
for example the viscosity. Table 8.1 shows the results of determining which fluid model is the best fit to the
experimental data, using formula 5.10.

Table 8.1: Fluid model fits to the experimental data for both sites.

Best Fit to Data


Texel Den Helder
Model
No. of Samples Percentage No. of Samples Percentage
Bingham (BH) 21 81 % 11 46 %
Herschel-Bulkley (HB) 5 19 % 13 54 %
No fluid data 12 7
Total No. of Samples 38 31

For Texel BH is the best fit for about 81% of the cases. The use of one model and that model being BH for
all samples from Texel may be a logical choice. For Den Helder, where a different drilling fluid is used (see
subsection 4.2.2 and subsection 4.2.3) BH is in about 46% of the cases the best fit, against 54% for the HB
model. Which model is the best fit for the fluid samples from Den Helder, is unclear.
The variable behavior of the fluid in both sites makes it difficult to incorporate the behavior of the fluid in
the calculations and makes most of the preliminary calculations less reliable. For example the value for the yield
stress, for which a minimum value is prescribed, is higher when calculated according to the BH model than when
calculated according to the HB model. An extreme example is presented in figure 8.1a. For most samples the
results are similar to those displayed in figure 8.1b. For samples taken in Texel the HB model’s yield stress is
between 48 and 97 % of the BH model’s yield point. For samples taken in Den Helder the range is larger. The
HB value is between 11 and 90 % of the BH value. In figure 8.2 the variations of the yield point are presented.
The line in both figure 8.2a and 8.2b is based on the yield stress of the models with the best fit.
Predictions or prescribed requirements may end up being invalid or unattainable since the ratios between
different properties vary from fluid model to fluid model. For example the ratio between viscosity and yield

55
56 8. Interpretation

point is different for the0 drilling fluid in Texel and the drilling fluid in Den Helder. The same carrying capacity
requires less annular pressure in Den Helder, so the risk of fracturing the soil or causing a blow out is lower.

(a) Fluid model data for sample PB1DH-A3-85-02.

(b) Fluid model data for sample PB1DH-A3-85-75.

Figure 8.1: Different examples of the fluid model data of a sample.


8.1. Drilling Fluid 57

(a) A plot of the yield stress for both the Bingham and Herschel-Bulkley model in Texel. The orange line indicates the yield
stress of the model that is closest to the measured data.

(b) A plot of the yield stress for both the Bingham and Herschel-Bulkley model in Den Helder. The orange line indicates the
yield stress of the model that is closest to the measured data.

Figure 8.2: The yield stresses of the fluid model with the best fit.
58 8. Interpretation

Weighting Factor
The formula used in calculating the fit (equation 5.10) has one disadvantage of particular interest for the purposes
of this research. It fails in providing information regarding the fit in the area that is of concern. That is why, in
this research, a weighting factor is added that is based on a calculated value for the shear rate. This is done to
account for the accuracy of the Bingham model at high shear rates, this can cause a wrong result of which fluid
model is most accurate at the shear rate regime in the borehole. In table 8.2 the result of shear rate calculations
is presented. The results are averaged per scenario.

Table 8.2: Shear rates in the annulus, averaged for every scenario. Method 1 is referring to equation 5.4 and method 2 to
equation 5.5. Both are used to calculate the shear rate in the borehole but the outcome is different.

Shear Rates, γr f [1/s ]


Texel Den Helder
Scenario Method 1 Method 2 Method 1 Method 2
1 7.34 2.83 8.87 2.91
2 6.83 2.63 8.24 2.70
3 5.10 1.96 6.19 2.03
4 4.56 1.47 3.88 1.03
5 4.24 1.37 3.61 0.96
6 3.19 1.03 2.70 0.65
7 1.75 0.45 0.68 0.14
8 1.62 0.42 0.63 0.13
9 1.21 0.31 0.47 0.10

As is presented in table 8.2 the shear rates are all low compared to the high shear rates (510 - 1020 1/s ) in
which the Bingham model is most accurate. When adding the weighting factor to formula 5.10 the formula for
calculation of the deviation between the calculated and measured shear stress becomes:
2
i ,d at a − τi ,c al c )
8 (τ
∆=
X
(8.1)
i (γi − γr f )2

In table 8.3 the results is presented for the deviation calculated taking the weighting factor into account. When

Table 8.3: Fluid model fits for both sites, taking a weighting factor into account as defined in formula 8.1.

Best Fit to Data + Weighting Factor


Texel Den Helder
Model
No. of Samples Percentage No. of Samples Percentage
Bingham (BH) 17 65% 8 33%
Herschel-Bulkley (HB) 9 35% 16 67%
No fluid data 12 7
Total No. of Samples 38 31

taking a weighting factor into account for the samples from Texel the BH model is the best fit in about 65% of
the cases. The use of only one model and that model being BH may not be such a logical choice. When taking
a weighting factor into account for the samples from Den Helder the BH model is the best fit in about 33% of
the cases. Choosing only one model may, in this case, not be a logical choice. This seems like a significant
change compared to using no weighting factor but the amount of samples that changed is still small, therefore
more research is recommended. The same graphs as depicted in figure 8.2 is created for both weighting factor 1
and weighting factor 2. The difference is minimal due to the amount of data points. The graphs can be found in
appendix D.3.
It has to be mentioned that all the samples have been tested only once and it is not known how large the
variation is which may occur as a result of the measurement equipment and the differences in the mixture itself.
The measurement at 3 Rotations Per Minute (RPM) is the most uncertain due to the possibility of gel starting
8.1. Drilling Fluid 59

to form. Due to the low shear rate in the borehole the 3 RPM measurement becomes more significant when
applying the weighting factor.

8.1.2. Time Dependent Behavior


More differences than mentioned above can be found between the drilling fluids. These differences may have an
influence on the behavior and properties of the drilling fluid. A bleeding test is performed by saving a sample
of the drilling fluid in Den Helder in a cylinder. Regular bleeding tests last 24 hours but since the stop test and
possible standstill in final construction can have a longer duration the test is continued for a week. This test is
performed to check the stability of the drilling fluid and to find out whether separation between solid and liquid
phase will occur.
In figure 8.3 the results is presented. The first few days the fluid started to separate (right top picture). There
is a small layer of water forming on top of the sample. The sample also increased in volume since the cylinder
is filled to the 1000 ml mark at the start of the test. After 4.5 days the fluid is increased to such an extent that
the water spilled over the top of the cylinder, no drilling fluid is lost. After a week the volume is decreased
again though not as far back as the initial volume. For stops of limited time, for example during the night, these
processes are not as significant as for stops of a longer duration.
These observations are made in static conditions, at atmospheric pressure and at the surface, major differences
with the borehole are higher temperature and contact with air. The observed behavior might not occur or be
different in magnitude or time scale in the borehole. However this means that a difference in fluid characteristics
does not only depend on mixing and the soil and groundwater chemistry. It can also depend on time related
processes that may occur in the drilling fluid. These processes might interact with the soil and groundwater.
Additional research is required to determine the when these processes occur, the magnitude and subsequently the
significance of the processes.

Figure 8.3: The long-time behavior of a sample from the drilling fluid used in Den Helder. This behavior includes
swelling/shrinking and separation of phases. The red circle encloses the same crack in the fluid, containing gas
and widening till day 4.5 and decreasing in size afterwards.
60 8. Interpretation

8.2. Transport and Flow Processes


The processes in this section are investigated in addition to the location determination using the Intersection
Method.

8.2.1. Flow Type


The Reynolds number can be used to determine whether the flow is laminar or turbulent. Using equation 5.15 the
Reynolds number for all samples, every scenario and both the BH and HB model are calculated. The Reynolds
numbers for both fluid models are of the same order and laminar flow is suspected to have occurred since the
Reynolds number does not cross the threshold value, 2000, for the transition to turbulent flow. In fact the
maximum value remains beneath 5% of that value. The full results can be found in appendix D.2.

8.2.2. Infiltration Loss


The expected infiltration loss for every sample is calculated. Due to uncertainties with regard to the reliability
of the results, for example the exact location of where the loss occurs is uncertain. Furthermore a loss of about
5m 3 for every 12 hour break, during the nights and after the stop test, remains unexplained. which is not taken
into account by equation 5.31. The D 15 that is used to determine the pore diameter in equation 5.31 requires
the results of additional Site Investigation (SI) since the D 15 of the sample from the return flow can be less than
that of the soil at source location, which would lead to an underestimation of the loss, which would influence
the calculated location of the loss and subsequently lead to a different sample source location for that sample
and a number of earlier samples. Instead of adding the uncertainties described above to the results of the source
location calculations, the loss of drilling fluid is a variable in the different scenarios (see section 6.2).

8.2.3. Transport
For the transport parameter, Y g , equation 5.42, 2 and 4 are recommended as values to prevent accretion of sand
in the borehole. The formula can be rewritten to estimate the D 90 the fluid can transport without accretion given
the transport parameter is a certain value.
When the measured D 90 of the sample is lower than the calculated value, D C al c this means that the coarser
material is not present at the source location otherwise it would have been transported. The transport is sufficient
and this is most often the case.
In a few cases the D 90 of the sample is larger than the D C al c for transport. In these cases it is unknown
whether the transport capacity is sufficient since coarser material than calculated left the borehole and thus the
value for the transport parameter is actually higher than 2 or 4. But even coarser material could have been left in
the borehole, forming a bed. These cases are counted as insufficient transport capacity.
In table 8.4 a summary is presented of the results. The results is presented in appendix D.1.

Table 8.4: Summary of the results from calculations of the maximum diameter for transport. The calculations are executed for
both the Bingham (BH) and the Herschel-Bulkley (HB) fluid model.

Texel Den Helder


Yg = 2 Yg = 4 Yg = 2 Yg = 4
Fluid Model BH HB BH HB BH HB BH HB
Sufficient (D 90 < D C al c ) 26 26 25 22 24 21 24 18
Insufficient (D 90 > D C al c ) 0 0 1 4 0 3 0 6
No Fluid Data 12 12 12 12 7 7 7 7
Total No. of Samples 38 38 38 38 31 31 31 31

In table 8.5 the D 90 of the samples taken from the vertical drillings during the initial SI are presented as well as
the D 90 from the samples taken from the return flow of the horizontal drilling. From this table it becomes clear
that a static bed is formed in the borehole since the D 90 of the vertical drilling is significantly higher than the
D 90 of the horizontal drillings for the same formation, which means that material remained in the borehole. For
example for the Peelo Formation the difference is about a factor 2. For the Urk and Appelscha Formation the
difference is significant as well. An exception is the D 90 of the Eem Formation on the Texel side. The D 90 of the
sample from the return flow is significantly higher than the D 90 of the samples from the vertical drilling. This
is due to the samples that are located at the bottom of the filled valley, as indicated by the results of the seismic
8.3. Sample Identification 61

survey. These are considerably coarser than the Eem Formation as encountered during the initial vertical drilling.

Table 8.5: The D 90 of the samples taken during the initial vertical SI and taken during the pilot drilling. When more samples
are tested the average is given. The bold figures indicate the cases where the D 90 of the samples taken during the
vertical drilling is larger than the D 90 of the samples taken during the pilot drilling.

Texel Den Helder


Vertical Samples Pilot Samples Vertical Samples Pilot Samples
Fm. D 90 [mm] D 90 [mm] D 90 [mm] D 90 [mm]
(No. Samples) (No. Samples) (No. Samples) (No. Samples)
Naaldwijk 0.312 (3) 0.218 (1)
Boxtel 0.322 (1) 0.310 (1) 0.256 (2) 0.332 (1)
Kreftenheye 0.209 (3) 0.329 (1) 0.242 (3) 0.269 (1)
Eem 0.236 (3) 0.406 (5) 0.345 (3) 0.348 (1)
Urk - Tynje 0.468 (9) 0.271 (13) 0.591 (4) 0.311 (3)
Peelo 0.937 (4) 0.436 (6)
Urk - Veenhuizen 0.377 (1)
Appelscha 0.426 (6) 0.838 (6) 0.491 (12)

8.3. Sample Identification


The samples taken from the return flow are identified by Freek Busschers and Jeroen Schokker, both geologists
working for TNO. The samples are sorted into groups (figure 8.4) and the groups are identified and defined based
on the samples and the results of the initial SIs (table 8.6). The inclusion of the results of the initial SI in the
determination led to the inclusion of group 6 which is not identified in the samples from the pilot drillings.

The formation to which the samples belong are identified based on multiple factors such as coarseness, presence
of micas and colored sand. No conflicting indicators of formations are found within one sample and as such the
samples are identifiable as coming from one formation. This implicates that no (significant) mixing has occurred
in the borehole. This means that no separation based on grain size has taken place (besides settling of the coarsest
grains) or at least not on a recognizable scale but also that the drilling fluid did not cause significant wall erosion.
Another implication is that a moving bed reaching the surface is less likely than a static bed.

Combining this with the results of section 8.2 indicates that the fluid model is of significantly less influence in
this specific case than previously assumed. Since no significant mixing occurs plug flow is the likely mode of
transport. Depending on the size of the sheared portion of the fluid the velocity of the plug is close to the average
fluid velocity in the borehole. For this research this means that the source can be determined with accuracy
without taking a fluid model into account. The calculation related to the drilling fluid only prove that this is
possible and are not required to calculate the difference between the cuttings velocity and the fluid velocity.

Knowing what soil is encountered also provides more information regarding the risks identified in section 2.2.
None of the risks in table 2.2 are as significant as assumed. The valley fill does not consist of gravel and larger
rocks but of slightly coarser sand from the Eem formation. At larger depths the soil is not so coarse that the
return flow stop due to infiltration losses. The Pot Clay, although encountered in Texel, is briefly drilled through
without significant problems. Drilling PB1T-B in Texel was aborted amidst conflicting observations around the
border to valley fill 2, so what is encountered there remains unclear.
62 8. Interpretation

Table 8.6: The grouped samples and the formation identification of the groups.

Texel Den Helder


Sample Code Group Sample Code Group Formation Group
B-65-TXL-03 1 PB1DH-A3-85-02 1 Boxtel Formation 1
B-65-TXL-04 2 PB1DH-A3-85-05 2 Kreftenheye Formation 2
B-65-TXL-05 3 PB1DH-A3-85-11 4 Eem Formation 3
B-65-TXL-07 3 PB1DH-A3-85-15 5 Urk Formation - Tynje 4
B-65-TXL-09 4 PB1DH-A3-85-16 5 Peelo Formation 5
B-65-TXL-10 4 PB1DH-A3-85-22 7 Urk Formation - Veenhuizen 6
B-65-TXL-12 4 PB1DH-A3-85-23 7 Appelscha Formation 7
B-65-TXL-13 4 PB1DH-A3-85-43 7 Appelscha Formation - Weerdinghe 8
B-65-TXL-15 4 PB1DH-A3-85-46 7
B-65-TXL-16 4 PB1DH-A3-85-47 7
B-65-TXL-28 4 PB1DH-A3-85-51 7
B-65-TXL-30 4 PB1DH-A3-85-54 7
B-65-TXL-32 4 PB1DH-A3-85-58 7
B-65-TXL-35 4 PB1DH-A3-85-59 7
B-65-TXL-40 4 PB1DH-A3-85-62 7
B-65-TXL-48 3 PB1DH-A3-85-63 7
B-65-TXL-51 3 PB1DH-A3-85-66 7
B-65-TXL-55 3 PB1DH-A3-85-69 7
B-65-TXL-59 3 PB1DH-A3-85-71 7
B-65-TXL-63 3 PB1DH-A3-85-75 7
B-65-TXL-67 3 PB1DH-A1-65-02 3
B-65-TXL-71 3 PB1DH-A1-65-05 4
B-65-TXL-74 3 PB1DH-A1-65-07 4
B-65-TXL-80 3 PB1DH-A1-65-09 4
C-85-TXL-04 4 PB1DH-A1-65-14 5
C-85-TXL-07 4 PB1DH-A1-65-17 5
C-85-TXL-09 4 PB1DH-A1-65-20 5
C-85-TXL-22 8 PB1DH-A1-65-23 5
C-85-TXL-25 7 PB1DH-A1-65-26 5
C-85-TXL-28 7 PB1DH-A1-65-29 5
C-85-TXL-31 7 PB1DH-A1-65-30 5
C-85-TXL-34 7
C-85-TXL-36 7
C-85-TXL-43 7
C-85-TXL-45 7
C-85-TXL-47 7
C-85-TXL-51 7
C-85-TXL-54 7
8.3. Sample Identification 63

(b) A small sample.

(c) A large sample.


(a) All Samples, Texel at the far end, Den Helder at the front.
Figure 8.4: An overview of the sieve results. Differences in samples size are mainly caused by a difference in the ratio
between the progress of the drill and the pump rate. In Texel this ratio was often much lower than in Den Helder
and as such the amount of grains left after sieving is often less for the samples taken in Texel than for the samples
taken in Den Helder.
64 8. Interpretation

8.4. Source Location


As mentioned before multiple scenarios are used to get an estimate of the source location. Scenario 1 has the
smallest diameter and the smallest loss of drilling fluid. This results in a source location relatively close to the
drill location at sampling time. Scenario 9 has the largest diameter and the largest loss of drilling fluid, this results
in a source location relatively far from the drill location at sampling time. Some scenarios result in unrealistic
source locations. For example for Den Helder in scenario 7, 8 and 9 it seems that the first few samples of the
second drilling belong to the end of the first drilling which is physically impossible due to the drill location and
thus the start of the return flow. This is presented in a number of ways: lag diagram, elaborated in subsection 8.4.1
and in plots of the samples locations, elaborated in section 8.5.

In table 8.7 the results of the first and last samples from the first drilling in both Texel and Den Helder are
shown for scenario 1, 5 and 9. It illustrates that the difference between scenario 1 and 9 increases with the
bore hole length, but the specifics appear to be highly influenced by progress rate, frequency of data points and
pump rate. As a result for a few samples multiple scenarios lead to the same source location. Figure 8.5a and
figure 8.5b graphically show the results of the Intersection Method for different scenarios on samples from the
same drilling in Den Helder. Sample PB1DH-A3-85-02 is taken at the start of the drilling at NAP-85m depth and
PB1DH-A3-85-75 is taken near the end of the drilling at NAP-85m depth.

Table 8.7: Results from different scenarios for different samples from the same drilling in both Texel and Den Helder.

Location Sample Code Drill Location at Sampling Time [m] Scenario Source Location [m]
1 88.5
B-65-TXL-03 111.95 5 79.1
9 60.3
Texel
1 1657.7
B-65-TXL-80 1681.58 5 1648.2
9 1600.1
1 48.8
PB1DH-A3-85-02 63.15 5 39.3
9 29.9
Den Helder
1 1871.6
PB1DH-A3-85-75 1973.66 5 1794.4
9 1298.6
8.4. Source Location 65

(a) Sample PB1DH-A3-85-02, taken at the start of the Den Helder drilling at
NAP-85m.

(b) Sample PB1DH-A3-85-75, taken at the end of the Den Helder drilling at
NAP-85m.

Figure 8.5: Plots of the results of the 9 different scenarios for two samples taken at the start and the end of the NAP-85m
drilling in Den Helder.
66 8. Interpretation

8.4.1. Lag Diagram


In this research there are data gathered about the flow rate, rate of penetration and connection time, this in
contrast to the original paper (Garcia-Hernandez et al., 2008). Furthermore the path of the drilling is known,
which shows that even in the horizontal part the inclination varies between about −2◦ to +2◦ with the horizontal
axis. In figure 8.6 and figure 8.7 the head location is plotted against the source location, as calculated in scenario
5. These two figures are based on measurements and calculation on data from this project. Which is in contrast
to figure 5.5, that is based on experiment in a laboratory (Garcia-Hernandez et al., 2008). Furthermore the source
location in this research is determined using corrected fluid velocity while cuttings velocity, determined in a
laboratory, is used in the original paper (Garcia-Hernandez et al., 2008). No such tests are performed for this
research and thus no data are available to determine this velocity. Lag diagrams for all scenarios can be found
in appendix D.4. In this appendix it is visible that the gradient of the lines graph for the NAP-65m and the
NAP-85m drilling becomes lower as the scenario number increases. Furthermore it is easy to spot the samples
that have unrealistic origins as the graphs become erratic, see figure 8.8.
It is presented that the ratio for progress of the drill head to pumped length is different in both sites. In Texel
the gradient of both the ’NAP-65m’ and ’NAP-85m’ line are about the same as the ’ROP=0’ line. Which means
that the pump rate is relatively high compared to the progress rate. In Den Helder the ’NAP-65m’ line has a
lower gradient and the ’NAP-85m’ line seems slightly lower as well. A lower gradient in this case means either
faster progress or a lower pump rate.

Figure 8.6: The lag diagram, relating the current location of the drill head to the location of the source of the cuttings found at
the surface, constructed from the data gathered in Texel.
8.4. Source Location 67

Figure 8.7: The lag diagram, relating the current location of the drill head to the location of the source of the cuttings found at
the surface, constructed from the data gathered in Den Helder.

Figure 8.8: The lag diagram for scenario 9 in Den Helder.


68 8. Interpretation

8.5. Cross-section
In this section the results of the calculations of the source location are plotted on the initial cross-section. Fig-
ure 8.9 to figure 8.17 show the outcomes for the different scenarios.
The identified samples enables both an improvement of the cross-section as well as a validation of the scenar-
ios. The validation is possible due to geological features that are known, for example from the vertical drillings
conducted onshore in the initial SIs or from the seismic survey.

Figure 8.9: The calculated source location of the samples, according to scenario 1, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 1.1 ∗ D Dr i l l and the loss is 0%.

In figure 8.9 the situation as a result of scenario 1 is presented. The parameters used in calculating scenario 1
make this scenario unlikely more importantly the result is not consistent with the results of the seismic survey.
Therefore, scenario 1 is improbable.
8.5. Cross-section 69

Figure 8.10: The calculated source location of the samples, according to scenario 2, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 1.1 ∗ D Dr i l l and the loss is
7%.

In figure 8.10 the situation as a result of scenario 2 is presented. The situation is possible but the parameters used
in calculating scenario 2 make it unlikely since the diameter of the borehole is probably larger. Furthermore the
results of the calculations contradict the results of the seismic survey.
Therefore, scenario 2 is improbable.
70 8. Interpretation

Figure 8.11: The calculated source location of the samples, according to scenario 3, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 1.1 ∗ D Dr i l l and the loss is
30%.

In figure 8.11 the situation as a result of scenario 3 is presented. The situation is possible but the parameters
used in calculating scenario 3 make it unlikely since the loss is high and the borehole diameter is probably larger.
Furthermore the results of the calculations contradict the results of the seismic survey.
Therefore, scenario 3 is improbable.
8.5. Cross-section 71

Figure 8.12: The calculated source location of the samples, according to scenario 4, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.4m for Texel, 0.45m for
Den Helder and the loss is 0%.

In figure 8.12 the situation as a result of scenario 4 is presented. This is a likely result as it is a close fit to
the seismic profile but the infiltration loss is 0 for this scenario, which makes it an unrealistic scenario. When
compared with the results of the previous scenarios it is presented that the results of the source calculations and
the results of the seismic survey are fitting better together.
Scenario 4 is improbable because of the assumed 0% loss for this scenario.
72 8. Interpretation

Figure 8.13: The calculated source location of the samples, according to scenario 5, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.4m for Texel, 0.45m for
Den Helder and the loss is 7%.

In figure 8.13 the situation as a result of scenario 5 is presented. This is a close fit to the seismic profile and has
plausible parameter values. Some samples are not fitting to what is known but in general the fit is good. Scenario
5 is the most probable out of the 9 scenarios tested in this research.
This is however based on the assumption that one scenario is the best fit to reality for both locations. For
Texel the results can checked with both the results of the initial vertical drilling and the results of the seismic
survey at significant horizontal distance away from the starting point of the drilling. For the Den Helder side
there is no data to check the results at horizontal distance away from the start of the drilling. This means that
although scenario 5 is used as the best fit for both locations it is uncertain which one scenario is the best fit to
reality on the Den Helder side.
8.5. Cross-section 73

Figure 8.14: The calculated source location of the samples, according to scenario 6, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.4m for Texel, 0.45m for
Den Helder and the loss is 30%.

In figure 8.14 the situation as a result of scenario 6 is presented. This is the first scenario in which at least one
result is unlikely without taking additional information into account. The yellow circle indicates a sample that
is close to another sample but belongs to a different formation. Horizontal distance between the two samples is
about 25m. It is however possible in this location due to the fact that there are two boreholes around that depth on
that location due to multiple attempts, as is presented in figure 4.2. The results of the seismic survey contradict
the calculated location of the Eem Formation at that point.
Scenario 6 is improbable because of the reasons mentioned above.
74 8. Interpretation

Figure 8.15: The calculated source location of the samples, according to scenario 7, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.55m for Texel, 0.85m for
Den Helder and the loss is 0%.

In figure 8.15 it is presented that the results of scenario 7 are contradicting each other. Sample origins in between
samples identified as other formations are indicated by a red circle. Sample origins at places where there has not
been drilled are indicated by a blue circle. This results comes from a combination of factors, among others the
frequency of the gathered data. A dark blue circle indicates where based on the order in which the samples are
taken the origin should be. The situation in the yellow circle is possible due to two boreholes around that location
due to multiple attempts, it is however not likely to be true due to the seismic profile made in the initial SIs.
Scenario 7 results in an unrealistic outcome for the samples from Texel and Den Helder and the 0% loss of
drilling fluids is unlikely as well.
8.5. Cross-section 75

Figure 8.16: The calculated source location of the samples, according to scenario 8, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.55m for Texel, 0.85m for
Den Helder and the loss is 7%.

In figure 8.16 it is presented that the number of samples at unrealistic positions is only increased in scenario 8
compared to scenario 7. The blue circle highlights samples that should be in the dark blue circle. The situation
indicated by the yellow circle is unlikely, due to the conducted seismic survey.
Scenario 8 results in an unrealistic outcome for the samples from Texel and Den Helder.
76 8. Interpretation

Figure 8.17: The calculated source location of the samples, according to scenario 9, plotted on the initial cross-section. The
color indicates the formation as identified by geologist from TNO. The diameter is 0.55m for Texel, 0.85m for
Den Helder and the loss is 30%.

In figure 8.17 it is presented that scenario 9 results in an unrealistic situation. The red circle highlights a sample
location between or beyond samples of another formation. In the blue circle samples are indicated that belong
in the dark blue circle, based on the order in which the samples are taken. The sample in the yellow circle is
unlikely to be from that location due to the information derived from the seismic profile.
When looking at the lag diagram of this scenario (figure 8.8) it becomes clear that the samples in the blue
circle are incorrectly located there. The points corresponding to those samples have a source location that is more
that the position of the drill head, this is physically impossible. The lag diagrams found in appendix D.4 show
the same erratic results for scenario 7 and 8.
Scenario 9 results in an unrealistic outcome for the samples from Texel and Den Helder and the 30% loss of
drilling fluids is unlikely as well.
8.6. Improved Cross-section 77

8.6. Improved Cross-section


Based on the results of the Intersection Method and the results of the initial SIs an improved cross-section can be
constructed.
Figure 8.18 depicts what is known from the initial SIs and the calculated source location of the samples. In
figure 8.19 a cross-section is constructed based on the data from figure 8.18. The certainty of the constructed
cross-section becomes less the further away from the drillings on the sides and the samples. This is indicated by
the dashed lines.
As is presented not all sample origins are perfectly aligned with what is known. Although scenario 5 is the
most probable scenario, there is still room for improvement. The outcome could be refined by adjusting the
scenarios and through iteration an improved outcome could be reached. This is not done since it is beyond the
scope of this research. The aim of this research is to see whether it is possible to connect the samples to a reliable
origin location.
More substantial improvements can be made by refining the Intersection Method. This can be done by
acquiring additional data, for example multiple data points for the drill location per joint. Refinement could also
be done by taking flow and transport processes into account. For example the location is now based on the fluid
head but it is likely that the grains had a lower velocity than the fluid. There are also indications that a bed has
formed in the borehole, this would decrease the cross-sectional area available for fluid flow. The velocity of the
flowing fluid would increase in the area free of the bed but would slow down or stop in the area where the bed is.
The cross-section in figure 8.19 is mainly based on what is known, since the sample origin calculations are an
approximation. What could make the approximation more accurate would be, for example; location based data
about the loss of drilling fluid and taking possible bed formation in the borehole into account would increase the
accuracy as well. Bed formation would result in a smaller area for the fluid to flow through, this would place the
sample origin closer to the drill head location at sampling time, ie. further from the surface, and could result in a
more accurate source location and thus a more reliable cross-section.
78
8. Interpretation
Figure 8.18: A cross-section with all that is known and the most probable sample locations.
8.6. Improved Cross-section
Figure 8.19: A cross-section based on what is known.

79
80 8. Interpretation

8.7. Summary
It is found that the behavior of the drilling fluid is difficult to describe with one fluid model. Which of the two
tested models varies from sample to sample. The flow is likely laminar as indicated by a value for the Reynolds
number of in all cases less than 50. The transport capacity is in most but not in all cases sufficient, this is indicated
by calculations as well as a comparison between the D 90 of samples from the vertical drillings and the D 90 of
samples from the return flow.
The cuttings velocity is assumed to be about the same as the average fluid velocity. This is indicated by the
calculations related to the fluid model and that no traces of significant mixing are found.
The risk identified in section 2.2 and table 2.2 are not as significant as previously assumed. In the valley
fill gravel and larger rocks layers are not found but instead a coarse sand from the Eem formation is found. At
larger depths the soil is not so coarse that the return flow stop due to infiltration losses. The Pot Clay, although
encountered in Texel, has been drilled through without significant problems despite its high strength.
In this research scenario 5 (Loss = 7% and the diameter of the borehole = 0.4 or 0.45, for respectively Texel
and Den Helder) is the most suitable, see table 8.8. This is due to the fit of the results to what is known, ie. the
results of the seimis curvey and the results of the initial vertical drillings. The arguments for this are however
mostly based on the samples from Texel. This is due to the seismic survey which intersects with the data from
Texel. It is however possible that the scenario with the best fit for the samples from Den Helder is another
scenario. Unfortunately there is nothing that the Den Helder samples, at distance, could be correlated with, so in
this research the same scenario is used for both Texel and Den Helder.
The lag diagrams created for this research, figure 8.6 till figure 8.8 and found in appendix D.4, can be taken
into account to study the reliability of the results. In the case that the samples are located out of order the
graphs become erratic with samples where the sample source is further than the drill head, which is physically
impossible. This is presented for scenario 7 and 8, both found in appendix D.4 and for scenario 9 the results are
erratic. In section 8.5 this is indicated in the figures by a blue circle.

Table 8.8: A brief summary of section 8.5.

Scenario Results
1 Inconsistent with previous results and unlikely scenario parameters.
2 Inconsistent with previous results and an unlikely scenario parameter.
3 Inconsistent with previous results and unlikely scenario parameters.
4 Consistent with previous results and an unlikely scenario parameter.
5 Most probable, consistent with previous results.
6 Inconsistent with previous results, improbable outcome and an unlikely scenario parameter.
7 Inconsistent with previous results, improbable and unrealistic outcomes and an unlikely scenario
parameter.
8 Inconsistent with previous results, improbable and unrealistic outcomes.
9 Inconsistent with previous results, improbable and unrealistic outcomes and an unlikely scenario
parameter.
9
Conclusions
This chapter presents the conclusions of this research. These are the main subjects:

• Drilling Fluid
• Source Location
• Cross-section
• Suitability of Horizontal Directional Drilling (HDD) for Site Investigation (SI).

Of the main subjects in this chapter; number 2 (Source Location), 3 (Cross-section) and 4 (Suitability of HDD
for SI) correspond to the 3 principal questions of this research defined in section 1.1. Main subject 1 (Drilling
Fluid) is required to investigate main subject 2 (Source Location) but it is not a question by itself.

9.1. Drilling Fluid


In this section all conclusions that are related to the different aspects of the drilling fluid can be found.

9.1.1. Fluid Model


The Bingham (BH) model is in Texel the best fit to the rheologic behaviour of the drilling fluid for about 80% of
the experimental data. In Den Helder it is less than 50%, with the more suitable fluid model being the Herschel-
Bulkley (HB) model. When using a weighting factor, increasing the importance of the deviation around the
calculated shear of the return flow, the BH model becomes the best suited model in less cases. Only 65% in Texel
and about 33% in Den Helder.
Other fluid models or another approach (to preliminary calculations) is worth investigating since the fluid
model and behavior are inconsistent during the drilling. Predictions or prescribed requirements may end up
being invalid or unreachable since the ratios between different properties vary from fluid model to fluid model.
This is the case with the yield stress. The value in the HB model can be as low as 11% of the value for the yield
stress in the BH model in Den Helder. The fluid model did not have to be taken into account in the calculation
of the source location since the grains appear to have been transported to the surface at fluid velocity. This is
implicated by the fact that no signs of mixing are found while identifying the samples.

9.1.2. Time Dependent Behavior


The properties of the drilling fluid used in Den Helder are changing in time. This in addition to changes caused
by interaction with the soil, groundwater and changes in fluid mixture. There are not enough data available for
Texel to investigate possible time dependency of the fluid properties for that location. In order for this change
to be taken into account, more research is required to determine the cause and the scale and subsequently the
significance of the processes.

9.1.3. Transport and Flow Parameters


The flow in the borehole is laminar and the build up of a bed is expected. This is indicated by the difference in
D 90 between the samples taken from the vertical drilling and the samples taken from the return flow. In general
the D 90 is lower for samples taken from the return flow compared to the D 90 of the samples taken from the
vertical drillings that are made onshore in both Texel and Den Helder.
This difference can be significant. For example for the Peelo Formation in Den Helder it is about a factor
2, D 90 = 0.937mm (based on 4 samples from the initial vertical drilling) versus D 90 = 0.436mm (based on 6
samples from the return flow during the horizontal drilling). An exception is the Eem Formation from the Texel
side for which the D 90 = 0.236mm (based on 3 samples from the initial vertical drilling) versus D 90 = 0.406mm

81
82 9. Conclusions

(based on 5 samples from the return flow during the horizontal drilling). This is due to the fact that the horizontal
drilling, drilled through the bottom of the filled valley where much coarser material is found.
The influence of a bed in the borehole on the return flow and on the calculated origin locations of the samples
is not taken into account in this research.
It is found that the properties and the fluid model of the return flow are determined by the properties of the
inflow, the soil, the groundwater and time dependent processes.

9.2. Source Location


The first goal of this research is to investigate whether it is possible to connect samples from the return flow to
a source location in the subsurface. This is possible but such a location can not be calculated at once due to the
uncertainties with regards to the diameter of the borehole and the loss of drilling fluid. Determination of a range
of possibilities in order to get an indication of what the subsurface might look like is possible. The Intersection
Method is created in this research for that purpose. An optimum scenario can be found by calibration if additional
SIs have taken place, such as in this project the vertical onshore drillings and the seismic survey.
In this research scenario 5 (loss of drilling fluid is 7% and the diameter of the borehole is 0.4m and 0.45m
for respectively Texel and Den Helder) is the most probable option because of the plausible parameters and the
small difference between the outcome of the scenario and the results of the initial SIs.
More data are required in order to calculate the source location solely based on data gathered during the pilot
drilling. An increase in the frequency of data, for example outflow, as well as additional data, for example gamma
ray, are required. These data would serve to decrease the uncertainties with regards to the losses and diameter of
the borehole as well as increase the data available to determine additional parameters of the soil.
Most of the risk identified before the pilot drillings as found in section 2.2 are regarding possibilities. During
the pilot drillings however most of these risks are found to be of less significance. None of the risks in table 2.2
are as significant as assumed. The valley fill does not consist of gravel and larger rocks but of slightly coarser
sand from the Eem formation. At larger depths the soil is coarser but not so coarse that the return flow stops due
to infiltration losses. The Pot Clay, although encountered in Texel, is briefly drilled through without significant
problems.

9.2.1. Lag Diagram


The lag diagram presents the source location as a function of the head location (Garcia-Hernandez et al., 2008).
In reality the HDD process is less predictable and assumptions made in the paper seem to be unrealistic. For
example it is wrong to assume that no interruption of the drilling process takes place or to assume that steady
state conditions occur for both flow rate and the rate of penetration. The lag diagrams shown in this research are
based on gathered data and the graphs are produced after the project. To calculate the source location using the
formulas given for the lag diagram, equation 5.44 and equation 5.45, the parameters in the formula would have
to be location dependent. For example the αh , which is the inclination with respect to the horizontal axis, still
varies between −2◦ and +2◦ during the horizontal part. An estimation could be made for the average Rate Of
Penetration (ROP) and coupling time, based on data from multiple projects. Coupling time is the time required
to connect the next pipe to the Drillstring (DS). The average ROP and coupling time should be included to make
the approach more useful in the field if such data are not (yet) available from the project.

9.3. Cross-section
The second goal of this research is to investigate whether it is possible to construct a cross-section based on the
results of the samples taken from the return flow. Construction of a cross-section is possible based on the samples
taken from the return flow of a HDD project. The samples are still identifiable after sieving, which reduces the
samples to grains of 0.063mm and larger. This means that no significant mixing of soil from different sources
has occurred in the borehole during transport. Therefore it is concluded that the effect of wall erosion is limited,
as this would add grains from the eroded formations along the borehole.

9.4. Suitability of HDD for SI


The third goal of this research is to investigate if HDD is suitable as a SI technique and if it can be improved,
based on experiences in the field. With a few adjustments compared to a regular HDD project, the Marsdiep
project gained a lot of additional data. That more can be acquired does not diminish the quality and quantity of
the data gathered at the sites for this project.
9.4. Suitability of HDD for SI 83

What does diminish the suitability of HDD as a SI technique is that in this research it is not possible to
connect the samples from the return flow to a source location in the subsurface without the results of additional
SIs to correlate the results. In order to improve the suitability additional measurements are required. When the
loss of drilling fluid and the diameter of the borehole are better known, HDD can be used separately as a SI to
determine the geology.
Among the additional data gathered for the Marsdiep project are detailed pump rates and pump times, part
of the data acquired by the Prodata system. Although these can be reconstructed from the driller logs, which are
part of a regular HDD project, it is less accurate that way and it is preferable that the data are acquired in as much
detail as possible.
10
Recommendations
This chapter presents recommendations for further research that needs to be conducted in order to improve
the accuracy of the source location determination and thereby the suitability of Horizontal Directional Drilling
(HDD) as a Site Investigation (SI) technique.

10.1. Drilling Fluid


More research considering other rheological models should be conducted. This is due to the uncertainty regarding
which of the fluid models is the most suitable for certain types of drilling fluid. Research should be done with
regards to the reliability of the results of the preliminary calculations, Research is also required to improve the
usefulness of these results, since the variation in which fluid model represents the fluid most has implications for
the fluid properties, in other words if the fluid changes to such an extent that the fluid model changes it is highly
recommendable that the properties according to the new model still fulfill the requirements.

10.1.1. Rheological Data Acquisition


The effect of the sieve test on the fluid properties should be investigated. An effect is noted during the fieldwork
but the extent of this is currently unknown. This could be investigated by making a drilling fluid that closely
resembles return flow and by dividing it in 3 parts. Part 1 and 2 are put through a 0.063 mm sieve without
vibration in order for the sand to be removed and not having it influence the equipment. Part 1 is tested in a
viscometer, part 2 is first mixed with a high shear mixer before testing the rheology in the viscometer and part 3
is put through a set of sieves on a vibrating table for about 10 min before testing the rheology in the viscometer.
The viscometer test could be done at different time intervals after sieving to check for time dependency.

10.1.2. Fluid Model


In this research a weighting factor is introduced to get a better idea which fluid model is most suited to describe
the fluid in a specific situation. However the weighting factor is applied after fitting the fluid models to the
experimental data. Further improvement could be reached by incorporating a weighting factor in the fitting
method. This would make the fit better around the required shear rate instead of just selecting the method which
has the best fit at that shear rate value.

10.1.3. Processes
For this research two of the most uncertain parameters, loss and diameter, are assumed to be constant along
the length of the drilling. This is however not realistic and further research should be conducted for a better
understanding of the processes down hole into the influence of this location dependency and into what influences
the amount of variation .
Research in this direction is performed but focused on pipes (Rice et al., 2015a,b). However getting an
understanding of the interaction of the fluid flow with the Drillstring (DS) and optional bed would improve the
understanding of the processes and increase the accuracy of the predictions as well as the calculated origin of
samples taken from the return flow.

10.2. Source Location


Calculation of the source location of the samples is reasonably accurate. Through iteration and comparing the
results to what is known, the scenarios could be adjusted to give a more accurate result. The Intersection Method
used in determining the source location of the samples could be refined in the following ways:

85
86 10. Recommendations

• Data; some data are gathered at an insufficient frequency at an unsuitable location, examples are drill head
location and return flow respectively. Additional data would improve the accuracy of the result without
improving the method.
• Location dependency; the uncertainties with regard to diameter and drilling fluid loss are solved by the
use of scenarios in this research. However these parameters are not the same along the borehole. Through
iteration of the process up and including constructing a cross-section the diameter and loss could be made
dependent on the location. Results of additional SIs are required for correlation.
• Determination of the grain velocity; this is done by implementation of the fluid and transport processes
occurring in the borehole. Some of these processes might require additional investigation into the occur-
rence and magnitude of influence. At present the source location is based on the fluid head location. It
is possible that the grains are transported at a slower rate than the fluid velocity. How much slower is
unknown but depended on among others the fluid and the transport processes (Garcia-Hernandez et al.,
2008).

10.3. Cross-section
By taking more data into account the cross-section can be significantly improved. These improvements might
not all be visible ones but the reliability of the cross-section can increase as well. For example in this research
the data gathered with respect to the torque and push/pull forces on the drilling rig are barely mentioned. When
taking those data into account a more refined geo-technical cross-section might be constructed. This can be done
by dividing the formation into geo-technical units with roughly the same properties based on the torque and
push/pull forces that are measured.

10.4. Suitability of HDD for SI


The accuracy of the flow test could be improved with the use of a method that enables continuous measurements
at the surface. A fairly simple example of such a method would be adding a pigment or a dye to the drilling fluid.
A more complex example could be a chemical of some kind that could be measured continuously directly in the
return flow. A continuous measurement would result in data about possible mixing in the borehole as well as
well as determining the peak in the return flow more precisely. The flow processes occurring during continuous
pumping in a borehole with a clean, thicker fluid, might be very different from what happens with a thinner fluid,
loaded with grains in a borehole are the DS rotates and is pushed forward and the pump stops roughly every 5
- 8 minutes for about 10 minutes. The results might not be that useful for figuring out what happens downhole
during drilling. It can however be used to determine the average diameter of the hole, which is required to get an
accurate estimate of the source location of the samples.
What would enable a more precise measurement of the loss would be among others the installation of a
flow meter on the pipe between the recycling unit and the tank where mud is made. This would serve to get an
estimate of the magnitude of the loss of fluid due to the recycling unit as well as due to the amount of cuttings.
This would improve the accuracy of a mass balance for the whole system. Adding a logged flow meter on the
casing would help to both measure the return flow accurately and the amount of backflow, if present. Losses
could be determined per length and this would result in an indication of the permeability of the soil as well as
improve the accuracy of the source location.
Data loggers on the pipes instead of flow meters, which have to be read manually, would improve both the
amount of data and would also allow for a location determination of where significant losses occur. A proposal
for an improved site setup is presented in figure 10.1.
So far these are all improvements to be made on the surface but additional tools could be lowered into the
borehole as well. In Texel a gamma ray log is put behind the drill head, which due to a change in companies is
not used throughout all the drillings in Texel. But such a tool, that measures the clay content of the surrounding
soil, can deliver very useful information about the situation in the borehole. Additional tools can be thought
of that can result in useful information, for example a tool that fulfills the same function as the calliper log in
Directional Drilling (DD) in the petroleum industry, would result in information about both the geometry in the
borehole as well as the size of the borehole. Measuring the size of the borehole during drilling and pulling back
would result in data about the sensitivity of the layers to erosion, depending on the difference in diameter on the
same location.
Improvements as mentioned above will result in an increased suitability of HDD for SIs. This will lead to
more knowledge and a better understanding of the soil and thus an optimization is possible of the both the design
and required material.
10.4. Suitability of HDD for SI 87

Figure 10.1: A flowchart of the site setup during the drilling in Den Helder.

For determination of the source of the sample fewer modifications to a regular project are required than described
above or depicted in figure 10.1. However additional SI (old or new) will be required to correlate the results and
find the most probable solution. To get the source of the samples through use of the Intersection Method, as
described in this research, the following data are required:
• Drill location
• Pump rate and when the pump is on
Both the drill location and the pump rate/ pump times are monitored and recorded during regular projects. Pump
time is often the same as drilling time, with the exclusion of additional pump time while no progress is made to
clean the borehole. The other required parameters can be varied till a solution is found that consistent with what
is known from additional SIs. Those parameters are diameter of the borehole and loss of drilling fluid.
Bibliography
Allouche, E. N., Ariaratnam, S. T., and Macleod, C. (2003). Software for Planning and Cost Control in Direc-
tional Drilling Projects. Journal of Construction Engineering and Management, ASCE 129(4):446–453.

API (2010). API RP 13D – RP for Rheology and Hydraulics of Oil-Well Drilling Fluids.

Arends, G. (1998). Trenchless Technology Research in the Netherlands. Tunnelling and Underground Space
Technology, 12(98):53–57.

Ariaratnam, S. T. (2001). Evaluation of the Annular Space Region in Horizontal Directional Drilling Installations.
Technical report, Arizon State University.

Ariaratnam, S. T., Harbin, B. C., and Stauber, R. L. (2007). Modeling of Annular Fluid Pressures in Horizontal
Boring. Tunnelling and Underground Space Technology, 22:610–619.

Baik, H. S., Abraham, D. M., and Gokhale, S. (2002). A Decision Support System for Horizontal Directional
Drilling. Tunnelling and Underground Space Technology, 18(03):99–109.

Bailey, W. and Weir, I. (1998). Investigation of Methods for Direct Rheological Model Parameter Estimation.
Journal of Petroleum Science & Engineering, 21:1–13.

Baroid (1997). Drilling Fluid Manual.

Baumert, M. E., Allouche, E. N., and Moore, I. D. (2005). Drilling Fluid Considerations in Design of Engineered
Horizontal Directional Drilling Installations. International Journal of Geomechanics, 5(December):339–349.

Bern, P., Morton, K., Zamora, M., May, R., Moran, D., Hemphill, T., Robinson, L., Cooper, I., Shah, S., and
Flores, D. (2007). Modernization of the API Recommended Practice on Rheology and Hydraulics: Creating
Easy Access to Integrated Wellbore Fluids Engineering. SPE Drilling & Completion, 22(December 2005):21–
23.

Bisschop, F. (1995). Transportprocessen in Boorgat en Transportleiding. Technical report, WL | Waterloopkundig


Laboratorium.

Brownline B.V. (2010). Drillguide GST.

Bueno, S. M. (2012). Horizontal Directional Drilling Guide - A Comprehensive Look at the North American
HDD Industry. Bernard P. Krzys.

Cheng, R.-C. and Wang, R.-H. (2008). A Three-Segment Hydraulic Model for Annular Cuttings Transport With
Foam in Horizontal Drilling. Journal of Hydrodynamics, Ser. B, 20(1):67–73.

Chhabra, R. (1993). Bubbles, Drops, and Particles in Non-Newtonian Fluids. CRC Press, Boca Raton.

de Mulder, E., Geluk, M., Ritsema, I., Westerhoff, W., and Wong, T. (2003). De Ondergrond van Nederland.
Wolters Noordhoff, Groningen/Houten.

Deltares (2010). Deltabrein - Soilrisk.

Denekamp, H., Grashuis, A., Hergarden, H., Kuyper, H., Mastbergen, D., Stoelinga, J., and Visser, T. (2000).
Handboek Horizontaal gestuurd boren ( HDD ). Technical report, Multiple Companies.

Duan, M., Miska, S., Yu, M., Takach, N., Ahmed, R., and Zettner, C. (2008). Transport of Small Cuttings in
Extended-Reach Drilling. SPE Drilling & Completion, 23(August 2006):5–7.

Espinosa-Paredes, G., Salazar-Mendoza, R., and Cazarez-Candia, O. (2007). Averaging Model for Cuttings
Transport in Horizontal Wellbores. Journal of Petroleum Science and Engineering, 55:301–316.

89
90 Bibliography

Garcia-Hernandez, A., Miska, S. Z., Yu, M., Takach, N. E., and Zettner, C. (2008). Determination of Cuttings
Lag in Horizontal and Deviated Wells. JPT, Journal of Petroleum Technology, 60:56–58.

Gjerstad, K. and Time, R. (2014). Simplified Explicit Flow Equations for Herschel-Bulkley Fluids in Couette-
Poiseuille Flow — For Real-Time Surge and Swab Modeling in Drilling. SPE Journal.

Graf, W. (1984). Hydraulics of Sediment Transport. Water. Res. Publ.

Hanks, R. (1980). ASME Paper No. 80-PET-45. In ASME Energy Sources Technol. Conf.

Haq, B. U., Hardenbol, J., and Vail, P. R. (1987). Chronology of Fluctuating Sea Levels since the Triassic.
Science (New York, N.Y.), 235(4):1156–1167.

Hemphill, T., Campos, W., and Philehvari, A. (1993). Yield-power law model more accurately predicts mud
rheology. Oil & Gas Journal, 91(34):45 – 50.

Huisman, M. (1999). Basiskennis boorvloeistoffen en foam. Technical report, WL|Delft Hydraulics.

ISO (2013). ISO 14688-1:2002 - Geotechnical investigation and testing – Identification and classification of soil
– Part 1: Identification and description. Technical report, ISO.

Kelessidis, V. and Bandelis, G. (2004). Flow Patterns and Minimum Suspension Velocity for Efficient Cuttings
Transport in Horizontal and Deviated Wells in Coiled-Tubing Drilling. SPE Drilling & Completion, 19(De-
cember).

Kelessidis, V. C., Maglione, R., Tsamantaki, C., and Aspirtakis, Y. (2006). Optimal determination of rheological
parameters for Herschel-Bulkley drilling fluids and impact on pressure drop, velocity profiles and penetration
rates during drilling. Journal of Petroleum Science and Engineering, 53(3-4):203–224.

Klotz, J. and Brigham, W. (1998). To Determine Herschel-Bulkley Coefficients. E & P Exchange.

Kruse, H. (2009). The Trenchless Technique Horizontal Directional Drilling - Soil Related Risks and Risk
Mitigation. In 4th Pipeline Technology Conference.

Madlener, K., Frey, B., and Ciezki, H. K. (2009). Generalized reynolds number for non-newtonian fluids.
Progress in Propulsion Physics, 1:237–250.

Mastbergen, D. and Aanen, L. (2003). Boorvloeistof indringingsproeven in zand en grind.pdf. Technical Re-
port 1, WL|Delft Hydraulics.

Mastbergen, D., Talmon, A., and Huisman, M. (1998). Druk en Transport in boorgang. Technical Report
december, WL|Delft Hydraulics.

Mendes, P. R. S. and Naccache, M. F. (2005). Dynamics of Fluid Substitution While Drilling and Completing
Long Horizontal-Section. In Latin American and Caribbean Petroleum Engineering Conference.

Mesdag, C., Diaferia, G., de Kleine, M., Hoogendoorn, B., Kruse, G., and van Heteren, S. (2014). Seismic
survey PWN Marsdiep. Technical report, Deltares.

Mesman, G., Dingerdis, I., and Beers, P. (2014). Breuk drinkwatertransportleiding naar Texel, zomer 2013.
H20-Online, page 10.

NEN 3651 (2012). NEN 3651 - Aanvullende eisen voor buisleidingen in of nabij belangrijke waterstaatswerken.

Nugroho, D., Kruse, H., and van Meerten, J. (2016). Interpretatie proefboringen Marsdiep PWN project 5551594.
Technical report, Deltares.

Nugroho, D. and van Meerten, J. (2015). Voorontwerp van de installatie van 4,5 km drinkwaterleiding onder
Marsdiep door middel van horizontaal gestuurde boring (HDD). Technical report, Deltares.

Ofei, T. N., Irawan, S., and Pao, W. (2014). Modelling of Pressure Drop and Cuttings Concentrations in Eccetric
Narrow Horizontal Wellbore with Rotating Drillpipe. Journal of Applied Sciences, 14(23).
Bibliography 91

Ozbayoglu, E. M., Miska, S. Z., Takach, N., and Reed, T. (2009). Sensitivity Analysis of Major Drilling Parame-
ters on Cuttings Transport during Drilling Highly-inclined Wells. Petroleum Science and Technology, 27(June
2015):122–133.

Peden, J., Ford, J., and Oyeneyin, M. (1990). Comprehensive Experimental Investigation of Drilled Cuttings
Transport in Inclined Wells Including the Effects of Rotation and Eccentricity. European Petroleum Confer-
ence.

Peeters, J., Busschers, F., Stouthamer, E., Bosch, J., Van den Berg, M., Wallinga, J., a.J. Versendaal, Bunnik,
F., and Middelkoop, H. (2016). Sedimentary architecture and chronostratigraphy of a late Quaternary incised-
valley fill: A case study of the late Middle and Late Pleistocene Rhine system in the Netherlands. Quaternary
Science Reviews, 131:211–236.

Pilehvari, A., Azar, J., and Shirazi, S. (1999). State-of-the-Art Cuttings Transport in Horizontal Wellbores. SPE
Drilling & Completion, 14(September).

Post, W. (2015). Beschrijving van HDD proefboringen voor PWN waterleiding Marsdiep. Technical report,
Deltares.

Prashant and Derksen, J. (2011). Direct simulations of spherical particle motion in Bingham liquids. Computers
and Chemical Engineering, 35(7):1200–1214.

Ramadan, A., Skalle, P., and Saasen, A. (2005). Application of a three-layer modeling approach for solids
transport in horizontal and inclined channels. Chemical Engineering Science, 60:2557–2570.

Rice, H., Fairweather, M., Peakall, J., Hunter, T., Mahmoud, B., and Biggs, S. (2015a). Measurement of particle
concentration in horizontal, multiphase pipe flow using acoustic methods: Limiting concentration and the
effect of attenuation. Chemical Engineering Science, 126:745–758.

Rice, H., Fairweather, M., Peakall, J., Hunter, T., Mahmoud, B., and Biggs, S. R. (2015b). Particle concentra-
tion measurement and flow regime identification in multiphase pipe flow using a generalised dual-frequency
inversion method. Procedia Engineering, 102:986–995.

Royal, a. C. D., Riggall, T. J., and Chapman, D. N. (2010). Analysis of steering in horizontal directional drilling
installations using down-hole motors. Tunnelling and Underground Space Technology, 25(6):754–765.

Slater, R. (1977). Engineering Plasticity: Theory and Application to Metal Forming Processes. London.

Sun, X., Wang, K., Yan, T., Shao, S., and Jiao, J. (2014). Effect of drillpipe rotation on cuttings transport
using computational fluid dynamics (CFD) in complex structure wells. Journal of Petroleum Exploration and
Production Technology, 4:255–261.

Talmon, A. and Huisman, M. (2005). Fall velocity of particles in shear flow of drilling fluids. Tunnelling and
Underground Space Technology, 20:193–201.

TNO (2013a). Lithostratigrafische Nomenclator van de Ondiepe Ondergrond, versie 2013.

TNO (2013b). Overzichtstabel Nomenclator.

TNO (2013c). Subsurface Models - GeoTOP.

van Meerten, J. and Nugroho, D. (2015). Evaluatie Proefboringen Marsdiep PWN project 5551594 E. Technical
report, Deltares.

van Rijn, L. (1987). Mathematical Modelling of Morphological Processes in the case of Suspended Sediment
Transport.

van Rijn, L. (1993). Principles of Sediment Transport in Rivers, Estuaries and Coastal Seas.

Vanoni, V. (1977). "Sedimentation Engineering". Manuals and Reports on Eng. Practice, 54.

Wan, Z. (1985). Bed Material Movement in Hyperconcentrated Flow. Journal of Hydraulic Engineering,
111(6):987 – 1002.
92 Bibliography

Wan, Z. and Wang, Z. (1994). Hyperconcentrated Flow.


Weir, I. and Bailey, W. (1996). A Statistical Study of Rheological Models for Drilling Fluids. SPE Journal,
1(04).

Zayed, T. and Mahmoud, M. (2013). Data acquisition and factors impacting productivity of Horizontal Direc-
tional Drilling (HDD). Tunnelling and Underground Space Technology, 33:63–72.
Zhou, H., Fan, H., Ji, R., Yin, D., Zhai, Y., and Ye, Z. (2013). A Comprehensive Methodology of Calculating
Hydraulic Parameters in Real Time and the Monitoring System. In SPE/IADC Middle East Drilling Technology
Conference.
Appendices

93
Contents Appendices

A Geology Background 96
A.1 Grain Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
A.2 Formations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
A.2.1 Naaldwijk Formation (NA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
A.2.2 Nieuwkoop Formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
A.2.3 Boxtel Formation (BX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
A.2.4 Kreftenheye Formation (KR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
A.2.5 Eem Formation (EE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
A.2.6 Drente Formation (DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
A.2.7 Urk Formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
A.2.8 Peelo Formation (PE). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.2.9 Formation of Appelscha (AP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.2.10 Formation of Peize (PZ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
A.3 Pre-Existing Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
B Initial Site Investigations, Proposals and Calculations 103
B.1 Initial Site Investigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
B.2 Drilling Proposals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
B.2.1 Texel - Proposed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
B.2.2 Den Helder - Proposed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
B.3 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
B.4 Parameters, Dimensions and Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
B.4.1 Geometry of the boring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
B.4.2 Product pipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
B.4.3 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
B.4.4 Drilling fluid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
B.4.5 Coefficient of friction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
B.4.6 Other. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
B.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
B.5.1 Minimal Drilling Fluid Pressure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
B.5.2 Torque and Normal Force. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
B.5.3 Rate Of Penetration (ROP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
B.5.4 Infiltration and loss of drilling fluid . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
B.5.5 Transport Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
B.5.6 Height of Mound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
B.5.7 Casing Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
B.5.8 Other. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
C Equipment and Tests 113
C.1 Laboratory Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
C.1.1 Marsh Funnel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
C.1.2 (Roto) Viscometer, (Fann) Rheometer . . . . . . . . . . . . . . . . . . . . . . . . . . 113
C.1.3 Mud Balance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
C.1.4 Electrical Conductivity Meter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
C.1.5 Sand Content Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
C.1.6 Sievetest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
C.1.7 pH Meter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
C.2 HDD Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
C.2.1 Mud Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

94
95

D Additional Results 117


D.1 Maximum Diameter for Transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
D.2 Reynolds Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
D.3 Yield Point - Best Fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
D.3.1 Texel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
D.3.2 Den Helder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
D.4 Lag Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
D.4.1 Texel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
D.4.2 Den Helder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
E Code of the SampleSource Program 133
F Code of the MarsdiepVisual Program 206
A
Geology Background
A more extensive overview of the geology is presented in this appendix.

A.1. Grain Size


In table A.1 the definitions used with regards to the grain size can be found.

Table A.1: The definition of grain sizes (ISO, 2013).

Name Size range (mm)


Large boulder >630
Very coarse soil Boulder 200–630
Cobble 63–200
Coarse gravel 20–63
Gravel Medium gravel 6.3–20
Fine gravel 2.0–6.3
Coarse soil
Coarse sand 0.63–2.0
Sand Medium sand 0.2–0.63
Fine sand 0.063–0.2
Coarse silt 0.02–0.063
Silt Medium silt 0.0063–0.02
Fine soil
Fine silt 0.002–0.0063
Clay ≤ 0.002

A.2. Formations
The different formations are described in chronological order, starting with the youngest.
The general paragraph of the descriptions is based on the Nomenclator from TNO.
The local occurrence paragraph is based on the descriptions of the inital drillings conducted for this project
as well as the sieve curves from samples gathered during the initial Site Investigations (SIs). The sieve curves
are created after the original descriptions and calculations are made and thus can result in a different description
of the soil. Tables with characteristic percentages can be found at the formations for which a sieve curve is
constructed. The characteristic percentages are based on those used in the preliminary calculations in order to be
able to make a comparison afterwards; D10, D15, D50 and D90.
The risk section is based on the risk matrix behind the Geobrain or Soilrisk website (Deltares, 2010), which
is based on the experience of a number of companies active in the underground in the Netherlands. The location
of the Marsdiep project is on the boundary between two areas for which the risks are classified and as such an
over prediction of the amount and severity of the risks may occur. The risks are subdivided into 9 ground related
risks and 3 risks related to groundwater. Only the most severe risks for Horizontal Directional Drilling (HDD)
are presented at the different formations in this thesis.
The parts will start with the name of the formation followed by, in brackets, the abbreviation used in figure 3.1
and the tables with the soil parameters in appendix ??. These tables are sorted on soil type so one table can contain
the parameters used for multiple formations.

96
A.2. Formations 97

Table A.2: Formation Descriptions, brief and in general, based on dutch formation descriptions (Nugroho and van Meerten,
2015).

Symbol Age & Formation Name Description of the soil type in the geological unit
Na Holocene: Naaldwijk Formation, Clay and locally peat, on silty sand with varying
layer set of Nieuwkoop grains size also inclusions of fine layers and shells;
locally fining upwards sequences, an indication of
gully filling
Bx Weichselien to Holocene: Boxtel Very fine to medium fine sand; silt and sandy units
Formation show results of cryoturbation
EE-BB Weichselien or Eemian: Eem For- Fine to medium fine sand with clay layers; layer-
mation Bruine Bank ing and the presence of thin fine coarsening up-
ward layers indicate a "low-energy" fluvial coast
environment.
Dr Saale Glaciation: Drente Formation Coarse and gravelly sand or boulder clay
EE-URTY Cromerien to Saale Glaciation: Urk Coarse, mostly gravelly sand, with local clay and
Formation, layer set of Tynje peat layers of limited spread and thickness in up-
per 10 meters of the unit (higher than NAP -50m);
high but varying conus-resistances with random
pattern indicate "high-energy" fluvial activity
Val_a Saale Glaciation or Eemian: Drente Coarse gravelly sand, in a complex or variable
Formation or Eem "valley fill", top part consists of fine to moderately
coarse sand
Val_b Saale Glaciation or Eemian: Drente Coarse gravelly sand, in a complex or variable
Formation or Eem "valley fill", with the possibility of a very coarse
gully filling at the bottom containing pebbles and
boulders present in a layer or as isolated blocks
higher in the "valley fill"
PENI Elster: Peelo Formation, layer set Strong (pot)clay
of Nieuwolda
PE Elster: Peelo Formation Medium fine sand with clay layers
URVE Cromerien to Saale Glaciation: Urk Medium to very coarse, generally gravelly sand;
Formation possibly fining upward toplayer (Elster)
AP, PZ Pliocene and early Pleistocene: Medium to very coarse, generally gravelly sand
Formation of Peize, Appelscha
Note: Some of the names of the ages correspond to glacial periods, these names are depending on
where they are identified as such, these names are different in different countries.

A.2.1. Naaldwijk Formation (NA)


General
The Naaldwijk Formation is formed in the Holocene, from 0.01 MA ago to the present. The formation is of
marine origin but is characterized by a strong variation in lithological content, varying from very coarse sand to
weak silty clay. It mainly consists of gray clayey sand, weak silty, can be calcareous and contain shells as well.
Often this formation is present at the surface but when covered it is by: peat from the Nieuwkoop Formation,
clay or sand from the Echteld Formation. These three formations are of the same age and can intersect into
each other. The formation is often discordant deposited on underlaying formations and the transition is sharp in
general. In the case that the Formation is deposited on the Eem Formation the border can be hard to determine,
as is the case on the Texel side of the Marsdiep HDD project.

Local Occurrence
Within the borings the Naaldwijk Formation is identified in the Texel boring as a brown to gray, moderately fine,
weak to moderately silty sand, which can contain traces of iron oxide, traces of micas, shells, small clay layers
and traces of detritus at the bottom of the formation, which could indicate the transition to Nieuwkoop Formation.
In the Den Helder boring it is identified as a brown to gray, moderately fine, well sorted, weak silty sand, which
98 A. Geology Background

can contain traces of organic material, traces of micas, shells and clay as well as some peat and gyttja layers
are found towards the bottom of the formation, which could be Nieuwkoop Formation. The sieve curves can be
described in Texel as a weak silty fine to coarse sand with one sample containing gravel and in Den Helder as a
silty fine sand.

Risks
This formation can consist of a weak clay which may be active so chemically swelling can occur. The formation
can consist of fine sand which is susceptible to erosion by the drilling fluid. The formation is also deemed to
be unpredictably variable. At the bottom of the formation wood can be encountered and form obstacles. The
groundwater is salt, which may pose a risk for the properties of the drilling fluid but no further risks are identified
with relation to the groundwater.

A.2.2. Nieuwkoop Formation


General
The Nieuwkoop Formation is formed in the Holocene, from 0.01 MA ago to the present. The formation consists
mainly of brown to black peat but can also contain clayey peat or sandy peat as well as Gyttja.
This formation is often found at the surface. If it is covered by another formation it is often the Naaldwijk
Formation or the Echteld Formation. These three formations are of the same age and often intersect into each
other. The bottom of this formation is often formed by the Boxtel Formation. If this is the case the transition is
sharp. In coastal areas intersection with the Naaldwijk Formation and the Echteld Formation is more common.

Local Occurrence
The Nieuwkoop Formation is not distinguishable from the Naaldwijk Formation and is not identified separately.
However it is suspected to be found between the Naaldwijk Formation and the Boxtel Formation, identifiable
only by a slight increase in organic and clay content, in particular small detritus layers and small clay layers or
inclusions. No sieve tests are conducted on samples from this formation in the initial SIs.

Risks
For the most part this formation is reasonably safe considering risks due to obstacles but it can contain parts of
old oak trees and at the bottom the boundary is formed by the transition to sand layers. Going from weak to
strong(er) layers may pose a range of risks, for example deviations from alignment or sideways bending of the
Drillstring (DS) as a reaction on the strong layers at the front but weak layers on the sides. The groundwater is
salt, which may pose a risk for the properties of the drilling fluid but no further risks are identified with relation
to the groundwater. .

A.2.3. Boxtel Formation (BX)


General
The Boxtel Formation is formed from the Middle Pleistocene to the Holocene, from 0.66 MA ago to present. In
this formation a few ground types are predominantly present:

• Light yellow to dark brown, very fine to moderately coarse sand which is weak to strong silty and can be
calcareous.
• Light yellow to light gray, very fine to moderately fine, very silty sand, which can be calcareous.
• Grayish brown to dark gray, weak to strong sandy loam, which can also contain clay and organic parts, can
be calcareous.

This formation can be found on the surface in the south and eastern parts of the Netherlands, in the Northwest.
However this formation is covered by the Echteld Formation, Naaldwijk Formation or Nieuwkoop Formation.
The bottom boundary in the Northwest of the Netherlands is often the contact with the Eem Formation, which is
a sharp transition to calcareous sands with fossils.

Local Occurrence
In the Texel boring this formation is identified as a gray, very to moderately fine, moderately to very silty sand,
which can contain traces of organic material and small layers of peat and clay. In the Den Helder boring this
formation is identified as a light brownish gray, very fine, moderately sorted, slightly silty sand. The sieve curves
can be described as a silty fine sand.
A.2. Formations 99

Risks
In the parts of the formation consisting of eolian sands there is a major risk of softening while drilling and the
soil is susceptible for erosion by drilling fluid. The formation is highly unpredictable due to the presence of filled
river valleys and stones can be present towards the bottom of the formation. The groundwater is salt, which may
pose a risk for the properties of the drilling fluid and locally over pressured aquifers can be found, which can
cause seepage into the drilled borehole and local borehole instability.

A.2.4. Kreftenheye Formation (KR)


General
The Kreftenheye Formation is formed in the mid Pleistocene and early Holocene. from approximately 0.24 to a
few thousand years ago. The Formation mostly consists of yellow gray to brown gray, moderately coarse to very
coarse, colored sand, which can contain gravel and chalk. Locally some clay and peat layers can be found. The
top of the formation in the Marsdiep area is typically formed by the Boxtel Formation or the Eem Formation.
Often a sturdy, gray to black clay layer is present at the top of the Kreftenheye Formation. In this case the
transition between the formations is sharp.

Local Occurrence
This formation is not identified during the initial SI. The formation is however identified during the investigation
of the samples from the horizontal drilling as a brownish, colored sand. Slightly deviating from the standard
description of the Kreftenheye Formation but it matches the description for unit A3, identified as the Kreftenheye
formation (Peeters et al., 2016).

Risks
The formation can be locally weak and due to the coarseness highly permeable. The ground water is salt, which
may pose a risk for the properties of the drilling fluid and there is a low risk for over-pressured aquifers.

A.2.5. Eem Formation (EE)


General
The Eem Formation is formed in the Eemian, an interglacial period and a stage in the Late Pleistocene from
0.126 to 0.116 MA ago. The Formation mostly consists of gray, moderately fine to very coarse sand with shells,
often contains chalk and with locally present shell layers. It can also contain dark gray clay and chalk layers.
The top of the formation in the Marsdiep area is formed by the Boxtel Formation and is noticeable as a change
towards, often non-calcareous, sand without fossils. At the bottom boundary a diatomite or gyttja layer can be
present and used as indication for the boundary. The underlaying formation is the Drente Formation in the area
of the project.

Local Occurrence
In the Texel boring this formation is identified as a gray to dark gray, well sorted sand, which can contain a few
detritus layers at the top of the formation, traces of colored material and clay layers. In the Den Helder boring
this formation is identified as a dark yellow to brownish gray, very sandy clay with micas or a brownish gray,
very to moderately fine, well sorted, slightly silty sand with traces of micas. The sieve tests reveal that the Bruine
Bank section is finer than the Eem formation and the samples indicate a weak silty to silty fine sand in Texel and
a very silty to silty fine sand in Den Helder for the Bruine Bank section. The curves from the Eem formation can
be described in Texel as a coarse sand and in Den Helder as a weak silty fine to coarse sand.

Risks
The formation is considered weak and the risk of softening of the sand is present. At the bottom of the formation
the permeability might be high. The groundwater is salt, which may pose a risk for the properties of the drilling
fluid and locally over pressured aquifers can be found, which can cause seepage into the drilled borehole and
local borehole instability.

A.2.6. Drente Formation (DR)


General
The Drente Formation is formed during the Middle and Late Saalian, a glacial period and a stage in the Middle
Pleistocene from 0.238 to 0.126 MA ago. In this formation a few ground types are predominantly present;
100 A. Geology Background

• Moderately to very coarse sand, with gravel.


• Grayish blue to brownish gray, clay and loam, sandy with gravel.
• Grayish blue to brownish gray, moderately fine sand, badly sorted can also contain gravel, cobble and
boulders.
• Dark gray to dark brown, weak to moderately silty clay, calcareous and strong.

In the western part of the Netherlands the top of this formation is formed by the Eem Formation. The transition
is gradual and can be determined by the presence of shells or when present by a diatomite or a gyttja layer at
the bottom of the Eem Formation. The Drente Formation is sharp and discordant deposited on older formations.
In this case the Urk Formation, which is recognizable as slightly more colored. If gravel is present this can be
used since the gravel in the Drente Formation has a glacial component, amongst others; flint, granite and more
crystalline, while the gravel in the Urk Formation doesn’t have this component.

Local Occurrence
This formation is identified as a gray, strong sandy clay, which can contain boulders on the Texel side and as a
sand which can contain boulders on the Den Helder side.

Risks
In this formation the permeability can be high and at the bottom of the formation obstacles might be encountered.
The groundwater is salt, which may pose a risk for the properties of the drilling fluid and locally over pressured
aquifers can be found, which can cause seepage into the drilled borehole and local borehole instability.

A.2.7. Urk Formation


General
The Urk Formation is a fluvial formation deposited by the Rhine from the Late Cromerian to the Middle Saalian.
Cromerian is a stage on the border between Early and Middle Pleistocene and Saalian is the last stage in the
Middle Pleistocene, thus the age of this formation ranges from circa 0.85 to 0.13 MA.
The Urk Formation mainly consists of gray, after oxidation yellow to brown, colored, moderately fine to very
coarse, sand with gravel. Which can be calcareous and contain organic remains. The formation can also consist
of fine to very coarse gravel, with a relatively high percentage of white quartz veins in the gravel.
The top of the formation is in general not clear when bordering on the Drente Formation. Only when gravel is
present a decrease in glacial gravel might be noticed. Since the formation is intersected with the Peelo Formation
this can be found on top as well. In this case the boundary is not clear but can be identified by a decrease in
the median of sand grains and the Peelo Formation is less colorful. For the bottom boundary with the Peelo
Formation the opposite is true. In the case that the Urk Formation borders on either the Peize or Appelscha
Formation, the border can be noticed because the soil becomes more calcareous, the variety of colors increases
and within the gravel an increase in quarts veins and a decrease in clear quartz.

Local Occurrence
The Urk Formation - Tynje Section is on the Texel side described as a gray, moderately fine to very coarse, slightly
to very silty sand, with traces of colored material, shells, white quartz and organic material and a variation in
sorting. The Tynje section is on the Den Helder side described as light gray to gray, slightly silty moderately
coarse sand, with traces of organic material and shells and badly to moderately well sorted. In Den Helder the
Veenhuizen section is identified as well. The Veenhuizen section is described as a gray, weak silty moderately
fine to moderately coarse sand, with traces of colored material, pink grains, few black grains and well sorted. In
general it appears that the Urk Formation is more diverse in appearance on the southern, Den Helder, side of the
project. Sieve tests conducted on samples from this formation indicate that the Tynje section consists of a coarse
sand on the Texel side and a fine sand on the Den Helder side. The Urk formation is only tested on the Den
Helder side are the curve indicates a weak silty fine sand.

Risks
The formation properties can vary unpredictably and as such there is a risk of encountering weak zones and the
sudden transition to strong(er) zones as well. Both chemically and physical swelling of the clay present might
occur and obstacles might be present at the bottom of the formation for the Tynje section. Urk and the Tynje
section might be very permeable. The groundwater is salt, which may pose a risk for the properties of the drilling
fluid and locally over pressured aquifers can be found, which can cause seepage into the drilled borehole and
local borehole instability.
A.2. Formations 101

A.2.8. Peelo Formation (PE)


General
The Peelo Formation is formed during the Elsterian, a glacial period and a stage in the Middle Pleistocene from
0.465 to 0.418 MA ago. The formation mainly consists of yellowish gray to light or dark gray and brownish gray,
very fine to moderately fine sand. It can also consist of light to dark gray and brownish black to black, weak silty
and sandy often very calcareous clay, which can be very strong. This part of the formation is also called ‘potklei’
(English; pot clay), or the Nieuwolda section, which is a very strong over-consolidated clay and is present in the
northern part of the Netherlands.
The top boundary is formed by the Urk Formation as well as the bottom. In general both boundaries are not
sharp but can be noticed by a change in the median of the sand present as well as by a change in the variety of
colors. The bottom can also make contact with the Formations of Peize and Appelscha.

Local Occurrence
Both distinct types of this formation can be found in the drillings from Den Helder and Texel. The Nieuwolda
layers are described as dark to blackish gray, weak silty clay on the Den Helder boring and as a dark gray, very
strong clay containing some gravel in Texel. In Den Helder the Peelo formation is described as a gray to dark
gray, moderately to badly sorted, moderately coarse to very coarse sand, which can contain silt, gravel and traces
of white quarts. Sieve tests indicate a weak silty, weak gravelly, fine to coarse sand.

Risks
This formation has a high risk of physical swelling where potclay occurs and can locally have a high permeability
and the sand that is present is sensitive to softening. There is a risk of weak to strong transition zones due to the
possibility of pot clay being present. The groundwater is salt, which may pose a risk for the properties of the
drilling fluid but no further risks are identified with relation to the groundwater.

A.2.9. Formation of Appelscha (AP)


General
The Formation of Appelscha is a fluvial formation deposited by the eastern rivers during the Bavelian and the
early Cromerian, roughly from 1.07 to 0.465 MA ago. In general it consists of a light gray to light yellow,
moderately fine to very coarse sand, with a possible large gravel fraction or it consists of a fine to very coarse
gravel with in the fine fraction relatively a lot of gravels with a specific origin for example Thuringian Forest
porphyry or basanite.
The top boundary with the Urk Formation is determined by the mineral content of the gravel fraction, a
change in the variety of colors and a change in chalk content. The bottom boundary with the Formation of Peize
is also determined based on a change in the content of the gravel fraction.

Local Occurrence
The Formation of Appelscha is only described on the Den Helder side since the drilling on the Texel side didn’t
reach the required depths. In this borehole it is described as a gray, moderately to very coarse, weak silty sand
with some shells and white quartz grains. Sieve tests indicate a weak silty, weak gravelly, fine to coarse sand.

Risks
This formation can be coarse and very permeable as well as highly variable. Obstacles might be present and the
groundwater is salt, which may pose a risk for the properties of the drilling fluid but no further risks are identified
with relation to the groundwater.

A.2.10. Formation of Peize (PZ)


General
The Formation of Peize is a fluvial formation deposited by the eastern rivers from the Reuverian to the start of
the Waalian, roughly from 3 to 1.20 MA ago. It mainly consists of a light gray to white, moderately coarse to
very coarse sand with a fine to moderately coarse gravel fraction. The formation doesn’t contain chalk which can
be used to separate it from the surrounding formations.
The top boundary with the Formation of Appelscha can be identified by a change of content in the gravel
fraction. The boundary with other formations is often identified based on the chalk content or color. The bot-
tom boundary with the Formation of Breda, Formation of Oosterhout or the Formation of Maassluis, can be
determined based on amongst others a change in mineral content, chalk percentage or a change in grain size.
102 A. Geology Background

Local Occurrence
Based the borings the Formation of Peize is not well recognized at the project site, it is not found in the Texel
boring and with a remark that it also could be Formation of Appelscha in the Den Helder boring. It is described
as a light gray to gray, moderately to very coarse, weak silty sand. In the sieve tests it is presented as a coarse
sand.

Risks
This formation can be coarse and very permeable. Obstacles might be present and the groundwater is salt, which
may pose a risk for the properties of the drilling fluid and locally over pressured aquifers can be found, which
can cause seepage into the drilled borehole and local borehole instability.

A.3. Pre-Existing Model


TNO created a model, GeoTOP, of the dutch soils to -50m NAP with a grid size of 100x100m and a vertical
resolution of 0.5m. This model currently covers parts of the Netherlands but the model is for the Marsdiep area.
While comparing the cross-section made for the Marsdiep project, figure 3.1, with the cross-section from TNO,
figure A.1 it becomes clear that neither of the cross-sections is complete. Since the cross-section for this project
is based on additional information, seismic data, Cone Penetration Tests (CPTs) and boreholes, this is used as a
basis in this research.

Figure A.1: Cross-section made with GeoTOP, available through DINOloket.nl, based on a collection of subsurface data,
(TNO, 2013c), with Texel on the left and Den Helder on the right side.
B
Initial Site Investigations, Proposals and
Calculations
This appendix contains information about the initial Site Investigations (SIs), proposals and the most relevant
results of the preliminary calculations.

B.1. Initial Site Investigation


The positions of the initial SIs can be found in table B.1 and table B.2. The coordinates are in the dutch coordinate
system.

Table B.1: Positions of the SIs in Texel.

Texel RD Coordinates [m] Ground level [mNAP] Depth [mNAP]


Drilling B1 115034,0 557492,0 0,72 - 82.8
CPT DKMP1 115074,0 557455,0 0,93 - 73,1
CPT DKMP2 115068,0 557505,0 0,48 - 44,2
CPT DKMP3 115063,0 557555,0 0,42 - 44,4
CPT DKMP4 115057,0 557605,0 0,42 - 44,4

Table B.2: Positions of the SIs in Den Helder.

Den Helder RD Coordinates [m] Ground level [mNAP] Depth [mNAP]


Drilling B2 115613,0 553189,0 3,95 - 99,30
CPT DKM5 115626,1 553185,0 5,57 - 36,5
CPT DKM5A 115627,1 553180,9 5,53 - 65,8
CPT DKM6 115636,8 553095,0 3,97 - 40,8
CPT DKM7 115648,0 553041,0 4,26 - 40,6
CPT DKM8 115659,0 552978,0 4,15 - 41,3

B.2. Drilling Proposals


This section contains the initial proposal for the pilot drilling. A quick overview of the alignments is presented
in figure B.1.

103
104 B. Initial Site Investigations, Proposals and Calculations

Figure B.1: Cross-section with the proposed alignments of the pilot drillings,generated in the program DGEOpipeline (Post,
2015).

B.2.1. Texel - Proposed


From the Texel side one or more pilot drillings will be attempted. At a depth of about NAP-35m to NAP-40m a
layer consisting of coarse and gravelly sand or boulder clay (Drente Formation) can be encountered. The local
composition, thickness and exact location are all relatively uncertain based on the results of the SIs performed in
Texel.
At the end of each drilling a stop is proposed which should last for 4 days, during which there would be no
flow or rotation in the borehole. Afterwards the torque and pressure necessary to get it going again are going
to be measured to get an idea of the borehole stability. Due to the fact that this is the moment that the most
equipment would be down-hole and thus the loss is the largest a compromise is made. Based on a graph of the
maximum torque and tensile load, see figure B.2 the equipment could handle and the amount at the moment
different scenarios are proposed for the stop.

• Scenario 1, both torque and tensile load are smaller than the 40% limit.
• Scenario 2, between the 40% and the 60% limit.
• Scenario 3, between the 60% and the 80% limit.
• Scenario 4, larger than the 80% limit.

Depending on the scenario the duration and start procedure are different. In general the drillbit would be
pulled back from the face before reducing the flow to 0 L/min. At the start the flow would be brought to 1500
L/min in about 15 minutes before rotation would start or the other way around depending on the scenario. In
all cases the torque would be measures while rotating at low speeds (5-10 Rotations Per Minute (RPM)) and no
flow. The method for pulling back is the same, once the torque is below a threshold value it would start, nine
pipes would be pulled while rotating but the tenth would be pulled statically.
B.2. Drilling Proposals 105

Figure B.2: A graph with the limits of both torque (kNm) on horizontal axis and tensile load (kN) on the vertical axis in black
dotted lines and different calculated cases in color.

PB1T-A
Due to the depth this boring will not be executed. The risk on fractures and blowouts would be to large. See
subsection B.5 in appendix B for more information.

PB1T-B
This is the first boring that is going to be executed. The length in total will be about 2500m and the depth of the
horizontal part will be about NAP-65m. This boring will encounter the "valley fill" which presumably consists of
coarse gravelly sand with possible occurrence of boulders as layers at the bottom of old filled trenches or isolated
higher on in the formation. If this boring doesn’t succeed after a few attempts, the next depth will be drilled.

PB1T-C1
This boring has a total length of about 1500m and the depth of the horizontal part will be about NAP-85m. It
is currently unsure whether the Pot Clay will be encountered. If the Pot Clay is present as a large, thick layer
beneath the valley fill, then after consultation and in agreement with PWN the next alignment, PB1T-C2, will be
executed.

PB1T-C2
This boring has a total length of about 1500m and the depth of the horizontal part will be about NAP-100m. This
boring will cut through the possibly present Pot Clay and end in the coarse gravelly sand formations (Formation
of Peize, Appelscha) from the Pliocene or Early Pleistocene.

B.2.2. Den Helder - Proposed


Which of the proposed pilot drillings from the Den Helder side will be executed depends on the results from the
borings on the Texel side. The borings starting in Den Helder will encounter beneath the Holocene top layers two
clay layers. The first layer at a depth of approximately NAP-35m to NAP-40m can consist of coarse and gravelly
sand or boulder clay (Drente Formation). The local composition, thickness and exact location are all uncertain.
The second layer is found at about NAP-47m to NAP-55m and is probably made of Pot Clay (Peelo Formation,
the Nieuwolda section). Before encountering the Eem formation at a depth of approximately NAP-40m a stop
is proposed to test the borehole stability and the erosion susceptibility of the possible loosely packed top layers.
106 B. Initial Site Investigations, Proposals and Calculations

During the first few hours the flow will be maintained at a lower volume (500L/min) while no progress is made,
in total the stop will last 2 days.
During the boring the effect of the Rate Of Penetration (ROP) shall be tested as well. In the horizontal part
at a certain lenght the ROP will be reduced from 3m/min to 1,5m/min, in order to investigate what the effect is
on the returnflow, pressures and borehole stability.

PB1DH-A1
This boring has a total length of about 1000m and the depth of the horizontal part will be about NAP-65m. It
ends in a layer consisting of mostly moderately fine sand, possibly loosely packed but coarse sand with clay
layers can be encountered as well (melt water deposits of the Peelo Formation).

PB1DH-A2
This boring has a total length of about 2000m and the depth of the horizontal part will be at a depth based on the
results of the borings on the Texel side of the Marsdiep.

B.3. Boundary Conditions


Before taking a look at the calculations the boundary conditions have to be determined. Based on the dutch
standards and the proposed alignment, see figure 3.4, the following boundary conditions can be determined
(Nugroho and van Meerten, 2015);

• Dikes need to be crossed at a minimum depth of 10m (NEN 3651, 2012). By starting 100m away from the
dikes and at an angle of 12◦ , the crossing is at a depth of -21.3m relative to the starting height.
• The pressure in the borehole is not allowed to exceed the strength of the surrounding soil, in order to
prevent fracturing and blow-out.
• The overpressure during stand still is at least 15 kPa and preferable 20 kPa, to ensure hole stability.

B.4. Parameters, Dimensions and Variables


Besides the boundary conditions the values of the following parameters either had to be estimated or are given
by the client, PWN.

B.4.1. Geometry of the boring


• The entry and exit angle is 12◦ .
• The radius of the corners are 1000 m, in order to enable the contractor to construct pipes up to 0.194m or
to be exact 7 5/8" in diameter.
• 3 options for construction depths, in other words depth of the horizontal part are considered; NAP -45m,
NAP-65m and NAP-100m, after the calculations this is changed to NAP-65 m, NAP-85 m and NAP-100
m.
• Radius of corner at entry point is about 1000*diameter of the pipe.

B.4.2. Product pipe


• The pipe has an outside diameter of 278 mm, proposed by PWN.
• Wall thickness of 9 mm.
• Material is steel.
• The yield strength of the pipe is 445 MPa (FE445).
• The volumetric weight is 78.5 kN /m 3 .
• Design pressure and test pressure are to be determined later

B.4.3. Execution
For the execution two scenarios are taken into account, for both scenarios the meeting in the middle method will
be used due to the length of the allignment.

• Scenario 1; pilot boring with a drill bit of 311 mm or 12.25", reamer of 406mm or 16" and pull in afterward.
• Scenario 2; pilot boring with a drill bit of 406 mm or 16" and pull in afterwards.

The following specifications are used in the different phases of the project, see section 2.3 for more information.
B.5. Results 107

Pilot phase
• The diameter of the borehole is 331 mm (scenario 1) or 410 mm (scenario 2).
• The outer diameter of the drill string is 194 m or 7 5/8".
• The wall thickness of the drill string is 10.2 mm.
• Flow rate of return fluid is 2000 liter/m.
• Circulation loss is 30%.
• The ROP is 0.05 m/s or 3 m/min.

Reaming phase and pull in phase


• The diameter of the borehole is 410 mm.
• The outer diameter of the drill string is 194 m or 7 5/8".
• The wall thickness of the drill string is 10.2 mm.
• Flow rate of return fluid is 2000 liter/m.
• Circulation loss is 20%.
• The ROP is 0.25 m/s or 15 m/min.

B.4.4. Drilling fluid


Initial
• The volumetric weight is 10.5 kN /m 3 .
• The plastic viscosity is 0.014 Pa.s.
• The yield stress is 11 Pa.

Normative of the return flow


• The volumetric weight is 11.1 kN /m 3 .
• The plastic viscosity is 0.014 Pa.s.
• The yield stress is 14 Pa.

B.4.5. Coefficient of friction


Determined in accordance with the NEN 3650-1:2012 for determining the pulling force between;
• Roller and pipe (f1) is 0.10.
• Pipe and drilling fluid (f2) is 50 Pa. This is the pressure loss caused by friction.
• Pipe and soil (f3) is 0.20.

B.4.6. Other
• The volumetric weight of the sea water is 10.1 kN /m 3 .
• The average sea level is set on NAP+0m for the preliminary design.
• The dry density of the clay in the drilling fluid is 2650 kg /m 3 .

B.5. Results
In this section the results of the preliminary calculations can be found. Most of the calculations are made using
DGeoPipeline.

B.5.1. Minimal Drilling Fluid Pressure


A summary can be found in table B.3. From these calculations it can be concluded that NAP-45m is not a feasible
solution is since for both scenarios this results in fracturing and for scenario 1 blowouts occur as well. At a depth
of NAP-65m fracturing still occurs in scenario 1 but not in scenario 2 and blowouts don’t occur at all. Neither
fracturing nor blowouts occur at NAP-100m.
108 B. Initial Site Investigations, Proposals and Calculations

Table B.3: Summary of the calculations made for the drilling fluid pressures.

P mi n:pi > P mi n:pi > P mi n:r e > P mi n:r e > P mi n:pu > P mi n:pu >
Scenario Design Depth Pf r P max Pf r P max Pf r P max
1 NAP-45m Yes Yes Yes Yes Yes Yes
1 NAP-65m Yes No Yes No Yes No
1 NAP-100m No No No No No No
2 NAP-45m Yes No NA NA Yes No
2 NAP-65m No No NA NA No No
2 NAP-100m No No NA NA No No
P mi n is the minimum required drilling fluid pressure in pilot phase (pi), reaming phase (re) and pull
in phase (pu).
P f r is the maximum drilling fluid pressure before fracturing occurs.
P max is the maximum drilling fluid pressure before blowout occurs.
NA means Not Applicable, since there is no reaming phase in scenario 2.

B.5.2. Torque and Normal Force


For the torque and normal force required on the drilling rig two cases are evaluated, a favorable and unfavorable
case. In the favorable case the friction coefficient is assumed to be 0.2 and for the unfavorable case a friction
coefficient of 0.3 is used based on previous experiences. Since the meeting in the middle point is not decided the
calculation gives an overestimation because the whole length is used. A summary of the results is presented in
table B.4.
Table B.4: Summary of the calculations made with regard to the torque and normal force.

Case Scenario Phase Tmi n [kNm] Tmax [kNm] Nmi n [kN] Nmax [kN]
Favorable 1 Pilot 60 70 900 1100
Favorable 1 Reaming 70 80 NA NA
Favorable 2 Pilot 60 70 1100 1300
Unfavorable 1 Pilot 80 90 1700 1900
Unfavorable 1 Reaming 90 100 NA NA
Unfavorable 2 Pilot 80 90 2250 2400
T for Torque, N for Normal or pressing force and NA for Not Applicable.

B.5.3. Rate Of Penetration (ROP)


The ROP is important for a number of reasons but mainly because it influences the properties of the drilling fluid.
The change in properties of the drilling fluid is determined by the ROP, volume of excavated soil and flow rate
of the return fluid. In tables B.5, B.6 and B.7 the results can be found of calculation based on different amounts
of drilling fluid, different penetration rates and the two scenarios. To maintain the return flow and make progress
in practice often these boundary values are used.
• The density ρ < 1130 kg /m 3
• The plastic viscosity µ < 0.04 P a.s
• The yield stress τ < 14 P a
• The sand content ≤ 15%
When taking this into account it is presented that in scenario 2 the density becomes higher than the boundary
value for any of the calculated cases. The recommendations (Nugroho and van Meerten, 2015) are;
• Use a flow rate of 2000 l/min and in order to maintain the density the penetration rate shouldn’t be too
high.
• The drilling fluid should be chosen in accordance to the different soils at different depths.
B.5. Results 109

Table B.5: Changing fluid parameters at different penetration rates and flow rates. Scenario 1, pilot phase.

Q [L/min] ROP [m/min] ρ [k g /m 3 ] µ [Pa.s] τ [Pa] Sand Content [%]


3,00 1224 0,015 14,19 8,42
1500
1,50 1153 0,014 12,52 4,5
3,00 1190 0,015 13,34 6,53
2000
1,50 1133 0,013 12,13 3,44
3,00 1168 0,014 12,84 5,33
2500
1,50 1121 0,013 11,90 2,78
3,00 1153 0,014 12,52 4,5
3000
1,50 1113 0,013 11,74 2,33

Table B.6: Changing fluid parameters at different penetration rates and flow rates. Scenario 1, reaming phase.

Q [L/min] ROP [m/min] ρ [k g /m 3 ] µ [Pa.s] τ [Pa] Sand Content [%]


3,00 1199 0,015 13,55 7,02
1500
1,50 1138 0,013 12,23 3,71
3,00 1170 0,014 12,88 5,41
2000
1,50 1122 0,013 11,91 2,83
3,00 1151 0,014 12,49 4,41
2500
1,50 1112 0,013 11,73 2,28
3,00 1138 0,013 12,22 3,71
3000
1,50 1105 0,013 11,60 1,91

Table B.7: Changing fluid parameters at different penetration rates and flow rates. Scenario 2.

Q [L/min] ROP [m/min] ρ [k g /m 3 ] µ [Pa.s] τ [Pa] Sand Content [%]


3,00 1323 0,019 17,23 13,79
1500
1,50 1212 0,015 13,86 7,73
3,00 1271 0,017 15,48 10,93
2000
1,50 1180 0,014 13,11 5,96
3,00 1236 0,016 14,49 9,05
2500
1,50 1160 0,014 12,66 4,87
3,00 1212 0,015 13,86 7,73
3000
1,50 1146 0,014 12,38 4,11
110 B. Initial Site Investigations, Proposals and Calculations

B.5.4. Infiltration and loss of drilling fluid


Because the pressure maintained in the borehole will be higher than the surrounding pressure, during standstill
and during drilling, the drilling fluid will infiltrate the surroundings. The results of the calculations can be found
in table B.8 for the pilot phase and table B.9 for the reaming phase. The soil parameters of the valley fill are
estimated so the calculated risks might be different. The deeper coarse sand layers might pose a bigger risk
since the values for the permeability derived from the sieve curve are relatively small for coarse sand/ fine gravel
layers.

Table B.8: The drilling fluid loss, per layer in the pilot phase.

Layer Scenario 1 Scenario 2 Risk in scenario 1 Risk in scenario 2


[L/m drilling] [L/m drilling]
Na 15 5 Slight Slight
Bx 20 10 Slight Slight
EE-BB 25 15 Slight Slight
Dr 40 20 Slight Slight
EE-URTY 30 25 Slight Slight
Val_a 380 210 High Moderate
Val_b 400 215 High Moderate
PENI NA NA Slight Slight
PE 40 30 Slight Slight
URVE 25 20 Slight Slight
AP 100 60 Moderate Moderate
PZ 500 260 High Moderate
NA stand for Not Applicable, since the PENI layer is a swelling clay.

Table B.9: Drilling fluid loss, per layer in the reaming phase.

Layer Scenario 1 [L/m drilling] Risk in scenario 1


Na 5 Slight
Bx 10 Slight
EE-BB 20 Slight
Dr 20 Slight
EE-URTY 25 Slight
Val_a 280 High
Val_b 300 High
PENI NA Slight
PE 25 Slight
URVE 20 Slight
AP 100 Moderate
PZ 360 Moderate
NA stand for Not Applicable, since the PENI layer is a swelling clay.

B.5.5. Transport Capacity


The transport capacity is calculated based on the maximum diameter of the grains the fluid can transport based
on the yield stress. The normative size of the grains is not allowed to surpass the calculated value in order for the
grains to be transported by the drilling fluid. The cases of two different yield stresses are considered; 11 Pa and
14 Pa. The results is presented in table B.10 and table B.11 respectively.
The case where the yield stress is 14 Pa is the most feasible. This is however very close to the boundary value
as given in the part on ROP in this section. If it will suffice to transport the soil found in the valley fills, needs
to be investigated in the pilot drilling. It is noticeable that it becomes less feasible with depth with especially the
layers below NAP-70m that can cause problems.
B.5. Results 111

Table B.10: The maximum grain size for transport, yield stress = 11 Pa.

Layer d 90 [mm] d max [mm] Risk for transport


Na 0,49 Slight
Bx 0,32 Slight
EE-BB 0,42 Slight
Dr 0,51 Slight
EE-URTY 0,58 Moderate
Val_a 0,74 Moderate
0,70
Val_b 1,29 High
PENI 0,07 Slight
PE 1,29 High
URVE 0,52 Slight
AP 1,50 High
PZ 1,50 High

Table B.11: The maximum grainsize for transport, yield stress = 14 Pa.

Layer d 90 [mm] d max [mml Risk for transport


Na 0,49 Slight
Bx 0,32 Slight
EE-BB 0,42 Slight
Dr 0,51 Slight
EE-URTY 0,58 Slight
Val_a 0,74 Slight
0,90
Val_b 1,29 High
PENI 0,07 Slight
PE 1,29 High
URVE 0,52 Slight
AP 1,50 High
PZ 1,50 High
112 B. Initial Site Investigations, Proposals and Calculations

B.5.6. Height of Mound


In order to see if the entry location is high enough to withstand the fluid pressures in the borehole, calculation
are made taking a high sea level into account, NAP+1.5m. Volumetric weights of 10.5 and 10.1 kN /m 3 are
taken into account for the drilling fluid and salt sea water in the surroundings. Two cases are considered, an
overpressure of 15 and 20 kPa. The results is presented in table B.12 and table B.13 respectively.

Table B.12: Required mound height, with high water and an overpressure of 15 kPa.

Depth in the axis of the alignment [mNAP] Drilling fluid pressure Required drilling fluid
incl. overpressure [kPa] level [mNAP]
NAP-6m (bottom of casing) 81 + 1,73
NAP-23,5m 268 + 1,98
Drilling to NAP-45m: 485 + 1,16
Drilling to NAP-65m: 687 + 0,40
Drilling to NAP-100m: 1040 - 0,94

Table B.13: Required mound height, with high water and an overpressure of 20 kPa.

Depth in the axis of the allignment [mNAP] Drilling fluid pressure Required drilling fluid
incl. overpressure [kPa] level [mNAP]
NAP-6m (bottom of casing) 86 + 2,21
NAP-23,5m 272 + 2,45
Drilling to NAP-45m: 490 + 1,63
Drilling to NAP-65m: 692 + 0,87
Drilling to NAP-100m: 1045 - 0,46

The existing heights of the entry points are NAP+0.42m for Texel and NAP+4.15m for Den Helder. Comparing
the required and existing height it becomes clear that the entry site in Den Helder is sufficient while the entry
point in Texel requires an artificial mound to the height of NAP+2m or NAP+2.5m depending on the required
overpressure.

B.5.7. Casing Length


At both entry sites the top layers consist of fine sand. In order to reduce the risks of blow-outs and prevent
borehole erosion a casing is recommended. The required depth in Den Helder is NAP-6m, the entry angle is
12◦ and the entry point height is NAP+4.15m. A casing of about 50m in length is required. In Texel a depth of
NAP-5.5m is required, the entry angle is 12◦ and the entry point height is NAP+0.42m. A casing with a minimum
length of 30m is required, the height of the mound is not included since it is unknown at this moment.

B.5.8. Other
In the report by Nugroho and van Meerten a number of other calculations are made as well, for example the
pulling force and the maneuverability. But since they’re not related to the topic of this thesis the calculations are
excluded.
C
Equipment and Tests
This appendix contains brief explanations and illustrations of the laboratory equipment that is used and the tests
that are performed. It contains a brief section on different Horizontal Directional Drilling (HDD) equipment as
well.

C.1. Laboratory Equipment


C.1.1. Marsh Funnel
The Marsh Funnel is a funnel with a certain shape and the exit has a specific diameter. There is a mesh (partially)
covering the top of the funnel to avoid the exit becoming blocked by larger grains. It is used by filling the funnel
to a given height and recording the time it takes for the fluid to fill a cup till a given level. This time can be used
as an indication for the viscosity.

C.1.2. (Roto) Viscometer, (Fann) Rheometer


The Viscometer determines the shear rate and shear stress of fluids at various times at atmospheric pressure. It
works by rotating a cylinder in the fluid around a free hanging weight weight, thus generating a shear rate. This
rate is transfered onto the weight which will rotate to a certain extend, the resulting angle can be measured and
used to gain other parameters as well. For example the plastic velocity is the angle at 600 rpm minus the angle
at 300 rpm and the yield point is the angle at 300 rpm minus the plastic viscosity. In figure C.1a the viscometer
that is used in Texel is presented. The following settings of the device are used; 600, 300, 100, 60, 30, 6 and 3
Rotations Per Minute (RPM). Since the device is sensitive the drilling fluid first had to be sieved in order to be
used in this device. Otherwise the cuttings could block or damage the device.

113
114 C. Equipment and Tests

(b) The Mud Balance used in Texel.

(a) The Visco Meter used in Texel. (c) The Electrical Conductivity Meter used in Texel.

Figure C.1: The Visco Meter, Mud Balance and EC meter used in Texel.

C.1.3. Mud Balance


The Mud Balance consists of a fixed volume cup attached to a lever, see figure C.1b. The cup is filled to a certain
level, afterwards a lid containing a valve is attached and using a small pump more fluid is added, resulting in a
slightly pressured fluid in which potential gas bubbles are very small and thus have very little influence upon the
accuracy of the measurement. The lever is put with a fixed point on a balance and by moving a weight along the
lever the density can be determined by reading it from the lever once the lever is in equilibrium.

C.1.4. Electrical Conductivity Meter


This device is used to get an indication of the salt present in the drilling fluid. While it can be correlated to the
amount of salt it is not used for that purpose but rather to check for trends. The device actually measures the
conductivity and that is not only caused by the amount of salt present but also by the amount of nutrients or
impurities in the fluid. The meter depicted in figure C.1c is used by putting the electrode into the drilling fluid
and waiting till the value on the screen has stabilized.

C.1.5. Sand Content Kit


A simple method is used to determine the amount of sand in the
return fluid. All parts are depicted in figure C.2. The glass vial
is filled to a certain marked level and then further filled with wa-
ter. The vial is than emptied in the white cylinder which con-
tains a sieve, the bottle is repeatedly filled with water and emp-
tied through the sieve until it is clean. The white funnel is placed
on the side where the vial is emptied and the sieve is than rotated
and cleaned upside down, everything that is on the sieve goes
through the funnel into the vial again. Once the sieve is empty,
the vial is shaken and everything that settles within a few seconds
is assumed to be sand.
Figure C.2: The sand content kit as used in Texel.
C.1. Laboratory Equipment 115

C.1.6. Sievetest
There is not enough time in between taking samples in Texel to do a full sieve test, so an adapted version is
conducted to get an indication of ratio between different size-fractions. A liter of the drilling fluid is put in the
sieves, which are stacked from coarse to fine (5,6 mm, 2 mm, 1 mm, 0,6 mm, 0,355 mm, 0.212 mm and 0,063
mm). The vibrating table is turned on for 10-15 minutes. Afterwards the sieves are washed and put down on
a white board to get an indication of the ratio between the amounts what is on the different sieves. The sieved
drilling fluid is used as for the viscometer. The sieve equipment used is displayed in figure C.3. The sieve test on
site is not only conducted to check for changes but the resulting sieved fluid is also required for the viscometer,
since grains can damage the device and distort the results of the viscometer tests. A time effect is noted in how
long after sieving the viscometer test is performed. Additional research should be conducted to determine the
magnitude of this effect as well as the influence of a vibrating table, used in the sieve test, on the measured fluid
properties. This effect is also noted when testing a sample from the clean inflow, before and after sieving on the
vibrating table.

(a) Without cap (b) With cap

Figure C.3: The sieve equipment used in Texel.


116 C. Equipment and Tests

C.1.7. pH Meter
In Den Helder a pH Meter is used since Teqgel requires a higher pH for optimum properties. This is discovered
during the first drilling in Den Helder so the pH is monitored during the second drilling.

C.2. HDD Equipment


A distinction is often made in HDD rigs on size. Although there is no hard answer to what constitutes a mini-
HDD, midi-HDD or maxi-HDD, this distinction is often used, amongst others by (Bueno, 2012; Denekamp et al.,
2000; Baik et al., 2002). As an example the definitions given by the Plastics Pipe Institute (PPI) in their 2009
report "Guidelines for Use of Mini-Horizontal Directional Drilling for Placement of High Density Polyethylene
Pipe – TR-46" as cited in (Bueno, 2012) are found in table C.1.

Table C.1: Definitions for different HDD rig classifications (Bueno, 2012).

Length [m] Depth [m] Diameter [m]


Mini-HDD <200 <5 <0.3
Midi-HDD <300 <25 <0.6
Maxi-HDD >300 >25 >0.6

In addition, for the Mini-HDD classification the following limits are given with respect to the maximum Pull
Forces and Torque, approximate 90 KN and 1.3 KNm respectively. The definitions that are present in (Denekamp
et al., 2000) and (Baik et al., 2002) are slightly different. In (Denekamp et al., 2000) an additional distinction in
midi-rigs, between small and large midi-rigs, is made. It is however important to note that it is partially based
on the same parameters length and pipe diameter. But as it is also important to mention that these definitions
can vary greatly depending on the source. A general trend is that the equipment and techniques become more
sophisticated with an increase in class. In other words; a maxi-HDD rig will have in general a more sophisticated
tracking system than a mini-HDD rig.

C.2.1. Mud Pulse


To get the data to the surface a mud pulse system is used initially used in Texel. The mud pulse system sends
pressure pulses through the drilling fluid in the Drillstring (DS). One initial problem with this system is that
the update frequency of the drilling parameters is too low, due to the string of parameters it is sending to the
surface. An adjustment is made that would allow the system to continue logging but it would only provide the
data required for steering and store the additional data to be read out at the end. Due to failing amongst others to
get a pump down gyro tool working, after several attempts and delays the company is replaced after a few days.
D
Additional Results
This appendix contains additional results.

D.1. Maximum Diameter for Transport


Table D.1: The D 90 is the sample, the D C al c is the calculated value using equation 5.42.

Texel
Yg = 2 Yg = 4
D 90 [m] D C al c BH [m] D C al c HB [m] D C al c BH [m] D C al c HB [m]
B-65-TXL-03 0.00031 0.002078 0.002017 0.001039 0.001008
B-65-TXL-04 0.000329 0.001188 0.000839 0.000594 0.00042
B-65-TXL-07 0.000264 0.001781 0.001644 0.000891 0.000822
B-65-TXL-09 0.000211 0.001781 0.001599 0.000891 0.0008
B-65-TXL-10 0.000194 0.001781 0.001644 0.000891 0.000822
B-65-TXL-12 0.000227 0.001484 0.001259 0.000742 0.000629
B-65-TXL-13 0.000206 0.001385 0.001185 0.000693 0.000592
B-65-TXL-15 0.000228 0.001385 0.001185 0.000693 0.000592
B-65-TXL-16 0.000188 0.001484 0.001259 0.000742 0.000629
B-65-TXL-28 0.000203 0.001286 0.000948 0.000643 0.000474
B-65-TXL-30 0.000243 0.001583 0.001343 0.000792 0.000671
B-65-TXL-32 0.000244 0.001484 0.001343 0.000742 0.000671
B-65-TXL-35 0.000375 0.001336 0.000908 0.000668 0.000454
B-65-TXL-40 0.000317 0.000891 0.000622 0.000445 0.000311
B-65-TXL-48 0.000307 0.001188 0.000948 0.000594 0.000474
B-65-TXL-51 0.000313 0.001583 0.001301 0.000792 0.00065
B-65-TXL-74 0.000467 0.001188 0.000829 0.000594 0.000415
B-65-TXL-80 0.00068 0.001089 0.000741 0.000544 0.00037
C-85-TXL-07 0.000434 0.001831 0.001644 0.000915 0.000822
C-85-TXL-09 0.000449 0.00188 0.001733 0.00094 0.000866
C-85-TXL-25 0.000319 0.00188 0.001735 0.00094 0.000868
C-85-TXL-31 0.000274 0.002573 0.002345 0.001286 0.001172
C-85-TXL-43 0.000472 0.001435 0.000691 0.000717 0.000346
C-85-TXL-45 0.000462 0.001237 0.001049 0.000619 0.000525
C-85-TXL-47 0.000479 0.001385 0.001175 0.000693 0.000587
C-85-TXL-51 0.000548 0.001583 0.001385 0.000792 0.000692

117
118 D. Additional Results

Table D.2: The D 90 is the sample, the D C al c is the calculated value using equation 5.42.

Den Helder
Yg = 2 Yg = 4
D 90 [m] D C al c BH [m] D C al c HB [m] D C al c BH [m] D C al c HB [m]
PB1DH-A3-85-02 0.000348 0.001845 0.000194 0.000923 9.69E-05
PB1DH-A3-85-05 0.000345 0.001214 0.000763 0.000607 0.000382
PB1DH-A3-85-11 0.000354 0.001311 0.000775 0.000656 0.000388
PB1DH-A3-85-15 0.000319 0.00102 0.00024 0.00051 0.00012
PB1DH-A3-85-16 0.000495 0.001263 0.000472 0.000631 0.000236
PB1DH-A3-85-22 0.000398 0.001263 0.000644 0.000631 0.000322
PB1DH-A3-85-43 0.00044 0.001748 0.001526 0.000874 0.000763
PB1DH-A3-85-47 0.000439 0.001505 0.001163 0.000753 0.000581
PB1DH-A3-85-51 0.000415 0.001457 0.001318 0.000728 0.000659
PB1DH-A3-85-54 0.000332 0.001554 0.001357 0.000777 0.000678
PB1DH-A3-85-58 0.000269 0.001845 0.001647 0.000923 0.000824
PB1DH-A3-85-62 0.000428 0.0017 0.001524 0.00085 0.000762
PB1DH-A3-85-66 0.000467 0.001894 0.001613 0.000947 0.000807
PB1DH-A3-85-69 0.000433 0.0017 0.001359 0.00085 0.000679
PB1DH-A3-85-71 0.000422 0.001651 0.001308 0.000826 0.000654
PB1DH-A3-85-75 0.000493 0.001845 0.001647 0.000923 0.000824
PB1DH-A1-65-02 0.000497 0.002039 0.001221 0.00102 0.00061
PB1DH-A1-65-05 0.000494 0.0017 0.001134 0.00085 0.000567
PB1DH-A1-65-14 0.000469 0.001651 0.001153 0.000826 0.000577
PB1DH-A1-65-17 0.000536 0.001457 0.000891 0.000728 0.000446
PB1DH-A1-65-20 0.000476 0.001263 0.000727 0.000631 0.000363
PB1DH-A1-65-23 0.000556 0.0017 0.001526 0.00085 0.000763
PB1DH-A1-65-26 0.000504 0.001651 0.001071 0.000826 0.000535
PB1DH-A1-65-29 0.000542 0.001748 0.001112 0.000874 0.000556
Texel - Reynolds Number
Scenario 1 Scenario 2 Scenario 3 Scenario 4 Scenario 5 Scenario 6 Scenario 7 Scenario 8 Scenario 9
BH HB BH HB BH HB BH HB BH HB BH HB BH HB BH HB BH HB
D.2. Reynolds Number

B-65-TXL-03 10.6 12.3 9.1 10.7 5.2 6.1 5.7 6.7 4.9 5.8 2.8 3.3 1.6 1.9 1.4 1.6 0.8 0.9
B-65-TXL-04 9.0 13.0 7.8 11.3 4.4 6.5 4.8 7.1 4.2 6.2 2.8 4.2 1.6 2.4 1.5 2.2 0.9 1.4
B-65-TXL-07 9.9 12.0 8.6 10.4 4.9 5.9 5.3 6.5 4.6 5.6 2.6 3.2 1.5 1.9 1.3 1.6 0.7 0.9
B-65-TXL-09 9.8 12.1 8.5 10.5 4.8 6.0 5.3 6.6 4.5 5.7 2.6 3.3 1.5 1.9 1.3 1.6 0.7 0.9
D.2. Reynolds Number

B-65-TXL-10 9.9 12.0 8.6 10.4 4.9 6.0 5.3 6.5 4.6 5.7 2.6 3.2 1.5 1.9 1.3 1.6 0.7 0.9
B-65-TXL-12 12.2 15.5 10.6 13.5 6.0 7.7 6.5 8.5 5.7 7.3 3.2 4.2 1.8 2.4 1.6 2.1 0.9 1.2
B-65-TXL-13 13.0 15.8 11.2 13.7 6.4 7.9 6.9 8.6 6.0 7.5 3.4 4.3 1.9 2.5 1.7 2.2 1.0 1.2
B-65-TXL-15 13.1 16.1 11.3 14.0 6.4 8.0 7.0 8.8 6.1 7.6 3.4 4.4 2.0 2.5 1.7 2.2 1.0 1.3
B-65-TXL-16 12.5 15.7 10.8 13.6 6.1 7.8 6.7 8.5 5.8 7.4 3.3 4.2 1.9 2.5 1.6 2.1 0.9 1.2
B-65-TXL-28 14.2 19.6 12.3 17.0 7.0 9.8 7.6 10.7 6.6 9.3 3.7 5.3 2.1 3.1 1.8 2.7 1.0 1.5
B-65-TXL-30 11.3 14.3 9.8 12.4 5.6 7.1 6.1 7.8 5.3 6.7 3.0 3.9 1.7 2.2 1.5 1.9 0.8 1.1
B-65-TXL-32 14.6 17.0 12.1 14.2 6.8 8.0 7.4 8.8 6.4 7.6 3.6 4.3 2.0 2.5 1.7 2.1 1.0 1.2
B-65-TXL-35 20.9 29.7 18.1 25.8 10.2 14.9 11.1 16.3 9.6 14.2 5.5 8.2 3.1 4.8 2.6 4.1 1.4 2.2
B-65-TXL-40 31.2 40.3 27.0 35.1 15.3 20.3 16.7 22.4 14.5 19.5 8.2 11.2 4.7 6.7 4.1 5.8 2.3 3.4
all scenarios.

B-65-TXL-48 31.1 38.4 26.9 33.3 14.3 18.1 15.7 19.9 13.5 17.2 7.4 9.5 4.1 5.4 3.5 4.7 2.0 2.6
B-65-TXL-51 29.8 37.1 25.7 32.2 14.4 18.3 15.8 20.1 13.5 17.2 7.4 9.5 4.1 5.4 3.4 4.6 1.8 2.4
B-65-TXL-74 45.1 61.7 39.0 53.7 21.5 30.2 23.8 33.6 20.3 28.8 11.3 16.3 6.4 9.5 5.5 8.2 3.1 4.7
B-65-TXL-80 70.9 93.4 61.4 81.4 28.9 39.4 31.5 43.5 27.3 37.8 16.1 22.7 9.0 13.2 7.8 11.4 4.3 6.4
C-85-TXL-07 20.2 24.4 17.4 21.2 9.9 12.2 10.8 13.3 9.4 11.5 5.3 6.6 3.0 3.8 2.6 3.2 1.3 1.7
C-85-TXL-09 21.4 25.4 18.5 22.1 10.5 12.6 11.4 13.8 9.9 12.0 5.6 6.8 3.2 3.9 2.8 3.4 1.6 2.0
C-85-TXL-25 22.4 27.3 19.4 23.7 11.0 13.5 12.0 14.7 10.6 13.1 6.1 7.6 3.6 4.5 3.1 3.9 1.8 2.2
C-85-TXL-31 17.8 21.6 15.4 18.7 8.8 10.8 9.6 11.8 8.3 10.2 4.7 5.8 2.7 3.4 2.3 2.9 1.3 1.7
C-85-TXL-43 31.8 59.8 27.6 52.1 15.6 30.1 17.0 33.1 14.7 28.8 8.3 16.6 4.8 9.9 4.1 8.6 2.3 4.9
C-85-TXL-45 37.9 45.6 32.8 39.6 18.5 22.7 20.3 24.9 17.5 21.6 9.9 12.4 5.6 7.2 4.9 6.2 2.8 3.6
C-85-TXL-47 34.9 42.5 30.2 36.9 17.0 21.1 18.6 23.2 16.1 20.1 9.1 11.4 5.2 6.7 4.5 5.8 2.5 3.3
C-85-TXL-51 36.0 42.7 31.1 37.1 17.6 21.3 19.2 23.3 16.6 20.2 9.3 11.4 5.1 6.4 4.4 5.5 2.4 3.1
Table D.3: The Reynolds number for every sample, both the Bingham (BH) and the Herschel-Bulkley (HB) fluid model and
119
120

Den Helder - Reynolds Number


Scenario 1 Scenario 2 Scenario 3 Scenario 4 Scenario 5 Scenario 6 Scenario 7 Scenario 8 Scenario 9
BH HB BH HB BH HB BH HB BH HB BH HB BH HB BH HB BH HB
PB1DH-A3-85-02 16.9 88.9 14.6 78.1 8.3 47.0 5.7 35.1 4.6 29.0 2.6 17.2 0.5 4.3 0.6 4.6 0.3 2.7
PB1DH-A3-85-05 17.5 26.3 15.1 22.9 8.6 13.2 5.9 9.3 5.1 8.1 2.9 4.6 0.6 1.0 0.5 0.9 0.3 0.5
PB1DH-A3-85-11 23.3 36.7 20.1 31.9 11.9 19.3 8.1 13.6 7.0 11.8 4.4 7.5 1.0 1.9 0.9 1.6 0.5 0.9
PB1DH-A3-85-15 30.9 80.4 26.8 70.6 15.3 42.4 11.3 33.7 9.8 29.5 5.7 18.1 1.1 4.2 1.0 3.7 0.5 2.1
PB1DH-A3-85-16 41.8 85.2 36.2 74.4 21.9 46.5 15.0 33.7 12.9 29.4 6.5 15.3 1.2 3.2 1.0 2.8 0.5 1.5
PB1DH-A3-85-22 35.6 59.4 30.8 51.8 17.5 30.3 12.1 21.8 10.6 19.2 6.1 11.3 1.3 2.7 1.2 2.3 0.7 1.4
PB1DH-A3-85-43 19.2 23.3 16.7 20.2 9.3 11.4 5.9 7.4 5.0 6.3 2.7 3.4 0.5 0.6 0.3 0.5 0.2 0.3
PB1DH-A3-85-47 32.9 41.8 25.5 32.7 12.9 16.9 8.7 11.6 7.5 10.0 4.1 5.6 0.8 1.1 0.7 0.9 0.4 0.5
PB1DH-A3-85-51 32.2 36.3 28.0 31.7 15.8 18.2 10.9 12.8 9.5 11.1 5.2 6.2 0.9 1.1 0.8 1.0 0.4 0.5
PB1DH-A3-85-54 33.4 38.9 28.9 33.8 16.2 19.3 10.8 13.1 9.4 11.4 5.3 6.5 1.0 1.2 0.8 1.1 0.4 0.6
PB1DH-A3-85-58 26.1 30.6 22.6 26.7 12.5 15.0 8.6 10.5 7.5 9.2 4.3 5.3 0.9 1.1 0.7 0.9 0.4 0.5
PB1DH-A3-85-62 29.3 34.0 25.4 29.5 13.9 16.3 9.5 11.4 8.3 10.0 4.6 5.6 1.0 1.2 0.8 1.0 0.5 0.6
PB1DH-A3-85-66 26.5 32.6 23.0 28.3 13.2 16.4 9.0 11.4 7.7 9.8 4.3 5.6 0.9 1.2 0.7 1.0 0.4 0.6
PB1DH-A3-85-69 29.3 36.9 25.5 32.2 14.5 18.6 9.9 13.0 8.6 11.3 4.9 6.5 1.0 1.4 0.8 1.2 0.5 0.7
PB1DH-A3-85-71 41.6 52.5 36.0 45.6 18.8 24.2 12.3 16.3 10.6 14.1 5.8 7.8 1.1 1.6 1.0 1.3 0.5 0.8
PB1DH-A3-85-75 36.3 42.5 31.6 37.1 18.7 22.2 12.7 15.4 11.0 13.3 6.0 7.3 1.1 1.4 0.9 1.2 0.5 0.7
PB1DH-A1-65-02 15.2 24.9 13.2 21.6 7.4 12.4 5.1 8.7 4.4 7.5 2.5 4.3 0.7 1.2 0.6 1.1 0.4 0.7
PB1DH-A1-65-05 28.7 41.9 24.9 36.5 13.9 20.8 9.5 14.6 8.2 12.7 4.7 7.3 0.8 1.3 0.7 1.2 0.4 0.7
PB1DH-A1-65-14 33.5 47.5 29.0 41.3 16.3 23.6 11.4 17.0 10.1 15.0 5.8 8.7 1.2 1.9 1.0 1.6 0.6 0.9
PB1DH-A1-65-17 33.9 51.6 29.3 44.9 16.5 25.9 11.2 18.1 9.7 15.7 5.4 9.0 1.1 2.0 1.0 1.8 0.5 0.9
PB1DH-A1-65-20 35.7 55.0 30.8 47.9 17.8 28.3 12.3 20.2 10.6 17.6 6.1 10.3 1.2 2.3 1.1 2.0 0.6 1.1
PB1DH-A1-65-23 28.9 33.3 25.1 29.0 14.2 16.6 9.7 11.6 8.4 10.1 4.6 5.6 1.0 1.2 0.8 1.1 0.5 0.6
PB1DH-A1-65-26 29.1 43.2 25.3 37.8 14.4 21.8 9.8 15.4 8.5 13.4 4.8 7.7 1.0 1.6 0.8 1.4 0.5 0.8
PB1DH-A1-65-29 27.0 41.1 23.7 36.2 13.9 21.6 9.6 15.3 8.3 13.3 4.8 7.8 1.0 1.7 0.9 1.5 0.5 0.9
Table D.4: The Reynolds number for every sample, both the BH and the HB fluid model and all scenarios.
D. Additional Results
D.3. Yield Point - Best Fit 121

D.3. Yield Point - Best Fit


The yield points is presented in figure D.1 and figure D.2. From top to bottom in both figures the results is
presented of the yield point from the model with the best fit, yield point from the model with the best fit with
weighting factor 1 and the yield point from the model with the best fit with weighting factor 2.

D.3.1. Texel

(a) The yield point according to the best fit of the fluid models. No weighting factor.

(b) The yield point according to the best fit of the fluid models. Weighting factor according to shear rate 1.

(c) The yield point according to the best fit of the fluid models. Weighting factor according to shear rate 2.

Figure D.1: Yield point and the best fit to the experimental data for Texel.
122 D. Additional Results

D.3.2. Den Helder

(a) The yield point according to the best fit of the fluid models. No weighting factor.

(b) The yield point according to the best fit of the fluid models. Weighting factor according to shear rate 1.

(c) The yield point according to the best fit of the fluid models. Weighting factor according to shear rate 2.

Figure D.2: Yield point and the best fit to the experimental data for Den Helder.
D.4. Lag Diagram 123

D.4. Lag Diagram


The lag diagram for all scenarios and both sites.

D.4.1. Texel

Figure D.3: The lag diagram for scenario 1 in Texel.


124 D. Additional Results

Figure D.4: The lag diagram for scenario 2 in Texel.

Figure D.5: The lag diagram for scenario 3 in Texel.


D.4. Lag Diagram 125

Figure D.6: The lag diagram for scenario 4 in Texel.

Figure D.7: The lag diagram for scenario 5 in Texel.


126 D. Additional Results

Figure D.8: The lag diagram for scenario 6 in Texel.

Figure D.9: The lag diagram for scenario 7 in Texel.


D.4. Lag Diagram 127

Figure D.10: The lag diagram for scenario 8 in Texel.

Figure D.11: The lag diagram for scenario 9 in Texel.


128 D. Additional Results

D.4.2. Den Helder

Figure D.12: The lag diagram for scenario 1 in Den Helder.


D.4. Lag Diagram 129

Figure D.13: The lag diagram for scenario 2 in Den Helder.

Figure D.14: The lag diagram for scenario 3 in Den Helder.


130 D. Additional Results

Figure D.15: The lag diagram for scenario 4 in Den Helder.

Figure D.16: The lag diagram for scenario 5 in Den Helder.


D.4. Lag Diagram 131

Figure D.17: The lag diagram for scenario 6 in Den Helder.

Figure D.18: The lag diagram for scenario 7 in Den Helder.


132 D. Additional Results

Figure D.19: The lag diagram for scenario 8 in Den Helder.

Figure D.20: The lag diagram for scenario 9 in Den Helder.


E
Code of the SampleSource Program
This appendix contains the full code of the main program written for this thesis. The code is as used, which
means that it is far from optimized and parts may be present but no longer in use.
1 ! ****************************************************************************
2 ! PROGRAM: SampleSource
3 !
4 ! PURPOSE : T h i s p r o g r a m i s u s e d t o g a t h e r t h e d a t a from a l l d i f f e r e n t s o u r c e s and
a n a l y z i n g a l l s a m p l e s one by one from one l o c a t i o n a t a t i m e and making c a l c u l a t i o n s w i t h
r e g a r d s t o t h e s o u r c e l o c a t i o n and t i m e a s w e l l a s t h e p r o c e s s e s t h a t h a v e t a k e n p l a c e .
5 !
6 ! REMARKS: E v e r y t h i n g marked "TO BE DONE: " i s t o be i n c l u d e d i n t h e f u t u r e t o make t h e
p r o g r a m and model more a c c u r a t e , i . e . :
7 ! * make a l l d a t e&t i m e c a l c u l a c t i o n c o r r e c t and c o m p l e t e r f o r a l l c a s e s , i e .
l e a p y e a r s and months o f d i f f e r e n t d a y s ( 3 1 , 2 8 , 3 0 ) , t h o s e t h i n g s . Y e a r s a r e t o t a l l y
i n g n o r e d f o r now .
8 !
9 ! ****************************************************************************
10
11 Program S o u r c e S a m p l e
12
13 Use S o u r c e M o d u l e
14
15 IMPLICIT NONE
16
17 ! Variables
18 ! −−−−−−−−−−−−−−−−−−−−−−
19
20 ! Program O p t i o n s
21 Integer :: ScenarioNo , ScenarioNo1 , ScenarioNo2
22
23 Integer :: FullRunCounter
24
25 Character (10) :: Location
26 Integer :: RunOption
27 ! RunOption = 1 , r e s u l t s i n a f a s t c a l c u l a t i o n w i t h m i n i m a l o u t p u t ;
28 ! RunOption = 2 , r e s u l t s i n maximum amount o f o u t p u t , s e p a r a t e f i l e s f o r a l l s a m p l e s e t c .
29 Character (3) :: FluidData ! I s No o r Yes
30 Integer :: ProgramOption
31
32 Real :: Loss_P
33
34 ! F o r r e a d i n g t h e i n p u t and c r e a t i o n o f t h e o u t p u t f i l e s
35 Character (*) , Parameter :: filefolder_in = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramInput \ " ! Inputfiles
36 Character (*) , Parameter :: filefolder_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ " ! Outputfiles
37 Character (*) , Parameter :: filefolder_out_1 = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ Option1 \ " ! S p e c i a l Cases
38 Character (*) , Parameter :: filefolder_out_extra = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ E x t r a F i l e s \ " ! Outputfiles
39 ! Two o t h e r l o c a t i o n s a r e used , t h e s e a r e however d e f i n e d where r e q u i r e d ( i n s u b r o u t i n e s ) .
40 ! G r a p h s a r e l o c a t e d i n "D : \ h i j n e k a m \ D e s k t o p \ Program \ G r a p h s \ " b u t t h i s i s n o t s p e c i f i e d
41 ! Backup f i l e s a r e l o c a t e d i n "D : \ h i j n e k a m \ D e s k t o p \ Program \ P r o g r a m O u t p u t \ S c e n a r i o s \ "
42 ! The b a c k u p f i l e s a r e e x t e n s i v e 2 * 9 f i l e s p e r sample , 1242 f i l e s i n t o t a l .
43
44 Integer :: I n p u t D i m =1 , InputCSV_PD =2 , InputCSV_PD_Fix =3 , InputCSV_Sur =4 , S a m p l e D a t a =5 ,
InputMP =6 , S i e v e R e s u l t s = 7 , S i e v e R e s u l t s _ V = 8

133
134 E. Code of the SampleSource Program

45 ! I n p u t f i l e s , a l l are used
46
47 Integer :: O u t p u t =21 , OutputGraph_PD =22 , O u t p u t G r a p h _ S u r =23 , O u t p u t S a m p l e s =24 ,
S a m p l e S o u r c e L o g =25 , SampleLog =26 , O u t p u t L o s s e s =27 , O u t p u t S a m p l e s L o c =28
48 Integer :: O u t p u t F l u i d P r o p e r t i e s =30 , O u t p u t F l u i d P r o p T e x = 31
49 Integer :: O u t p u t T r a n s p o r t P r o p e r t i e s =40 , O u t p u t T r a n s p o r t P r o p T e x = 41
50 ! O u t p u t f i l e s , n o t a l l o f them a r e u s e d i n e v e r y r u n o p t i o n .
51
52 Integer :: T a b l e H a n s =99
53
54 Character (150) : : filename
55 Character (150) : : name
56 Character (150) :: title_graph
57 Character (150) :: title
58
59 Real :: Value , Margin
60 Integer :: I n d e x , Index_PD , I n d e x _ S u r
61 Integer : : Index_PDMF ! Adapted v a l u e f o r s t a b i l i t y r e a s o n s , i t i s t h e
v a l u e l o w e r t h a n Index_PD f o r which a mudflow i s g i v e n i n t h e P r o D a t a f i l e .
62 Integer :: Index_Sol_PD , I n d e x _ S o l _ S u r
63
64 ! S t a n d a r d s and c o n s t a n t v a r i a b l e s
65 Integer :: i , j , MainI ! Do l o o p i n t e g e r s
66 Real ( 8 ) , Parameter :: P I = 4 . d0 * a t a n ( 1 . d0 ) ! Quite p r e c i s e
67 Real , Parameter : : g = 9 . 8 0 6 6 5 d0
68
69 Real , Parameter :: n_BH = 1 . d0
70 Real , Parameter :: MinYg = 2 . d0
71 Real , Parameter :: MaxYg = 4 . d0
72 Real , Parameter :: Rho_Grain = 2 6 5 0 . d0
73
74 ! Variables regarding reading of the input f i l e s
75 Integer :: n l i n e s , n l i n e s _ d a t a , Nlines_PD , N l i n e s _ s u r , i o
76 Integer , Allocatable : : Bit_DPT ( : ) , Hol_DPT ( : ) , Car_POS ( : ) , Car_SPD ( : )
77 Integer , Allocatable :: P u l l ( : ) , Push ( : ) , T o r q _ p o s ( : )
78 Integer , Allocatable : : Rot_SPD ( : ) , M_Press ( : ) , MudFlw ( : ) , T o r q _ n e g ( : )
79 Integer , Allocatable :: P r e s s _ 1 ( : ) , P r e s s _ 2 ( : ) , P r e s s _ 3 ( : ) ,HS_D ( : )
80
81 Character (8) , Allocatable :: D a t e ( : ) , Time ( : )
82 Integer , Allocatable : : J o i nt ( : ) , Btot ( : )
83
84 Real , Allocatable : : CL ( : ) , I n c l i n a t i o n R a w ( : ) , AzimuthRaw ( : )
85 Real , Allocatable : : HS ( : ) , Dip ( : ) , E l e v a t i o n C a l c ( : ) , ElevationMGS ( : )
86 Real , Allocatable : : R_Calc ( : ) ,R_MGS ( : )
87
88 Real ( 8 ) , Allocatable : : Away ( : ) , MD( : )
89
90 ! Variables
91 Character (19) , Allocatable :: DateTime_PD ( : )
92 Character (19) , Allocatable :: DateTime_Sur ( : )
93 Character (19) , Allocatable :: DateTime_Samples ( : )
94 Character (19) :: DateTimeSample
95
96 Integer :: TimeInt
97
98 Integer (2) :: Day , Month , Hours , M i n u t e s , S e c o n d s
99 Integer (4) :: Year
100
101 Integer , Allocatable :: TimeInt_PD ( : ) , T i m e I n t _ S u r ( : )
102 Real , Allocatable :: PumpVol ( : )
103 Real , Allocatable :: TranspLen ( : )
104 Real ( 8 ) , Allocatable :: TranspLenSum ( : )
105
106 Real :: D_bh , D_ds
107 Real :: D_drillbit
108 Real :: Thickness_ds
109 Real :: L e n g t h _ P i p e , Length_BHA
110 Real :: Planned_Azimuth
111 Real :: C o n v e r s i o n _ D e g r _ P a , Conversion_RPM_PerS
112 Real :: Conversion_Degr_lb , Conversion_lb_Pa
113
135

114 Real :: A_bh , A_ds , A _ a n n u l u s


115
116 Real , Allocatable : : Away_PDInt ( : )
117
118 Real :: SourceLoc_PD , S o u r c e L o c _ S u r , SourceLocAV
119 Real ( 8 ) , Allocatable : : SourceLocAvAll ( : )
120
121 Real :: TimeInS
122 Integer :: HH, MM, SS
123
124 Integer :: TimeIntAv
125 Integer , Allocatable : : TimeIntAvAll ( : )
126 Integer :: TimeInt1 , TimeInt2
127
128 Integer , Allocatable : : PumpTimesAll ( : )
129 Integer :: PumpTime
130
131 Character ( len =:) , Allocatable : : Sample_ID ( : ) ! L e n g t h and number i s v a r i a b l e d e p e n d i n g
on t h e l o c a t i o n .
132 Character ( len =:) , Allocatable : : Sample_Code ! L e n g t h i s v a r i a b l e d e p e n d i n g on t h e
location .
133 Integer :: No_Samples
134
135 Real ( 8 ) , Allocatable :: PositionBitAll (:)
136 Real , Allocatable :: Temp ( : ) ,EC ( : ) , pH ( : ) ,MF ( : ) , Rho_Bf ( : ) , SC ( : )
137 Integer , Allocatable :: RPM_600 ( : ) , RPM_300 ( : ) , RPM_200 ( : ) , RPM_100 ( : )
138 Integer , Allocatable :: RPM_60 ( : ) , RPM_30 ( : ) ,RPM_6 ( : ) ,RPM_3 ( : ) , G e l 1 0 s ( : ) , Gel10min ( : )
139
140 Real ( 8 ) , Dimension ( 8 ) : : GammaY
141 Real ( 8 ) , Dimension ( 8 ) : : LogGamma ! Log ( gamma )
142
143 Real ( 8 ) , Dimension ( 2 0 ) :: Tau
144 Real ( 8 ) , Dimension ( 2 0 ) :: Tau_Calc_HB
145 Real ( 8 ) , Dimension ( 2 0 ) :: Tau_Calc_BH
146
147 Real ( 8 ) , Dimension ( 8 ) : : Y ! Log ( Tau − T a u _ y i e l d )
148 Real :: Tau_Yield_HB
149 Real :: K, n
150 Real , Allocatable : : Tau_Yield_HB_Tot ( : )
151 Real , Allocatable : : K_Tot ( : ) , n _ T o t ( : ) ! Best f i t of a l l samples
152
153 Real :: Alpha , D e l t a
154 Real , Allocatable : : A l p h a _ T o t ( : ) , Delta_Tot_HB ( : ) , Delta_Tot_BH ( : )
155 Real ( 8 ) , Dimension ( 2 0 ) :: Delta_All , Alpha_All
156
157 Real :: PV , YP
158 Real , Allocatable : : PV_Tot ( : ) , YP_Tot ( : )
159
160 Character (3) , Allocatable :: Activity (:)
161 Integer , Allocatable : : J o i n t _ M P ( : ) , P_Max1 ( : ) , P_Max2 ( : ) , P_Min ( : ) , P _ C a l c ( : ) , P _ R e a l ( : )
162 Real , Allocatable : : Length_MP ( : )
163 Integer :: Nlines_MP
164
165 Integer :: JointNo
166 Integer (2) :: Day_MP , Month_MP
167 Character (3) :: ActivityKey
168
169 Real , Allocatable : : Mud_P_Tot ( : )
170 Real :: MaxPlugR
171 Real :: Tau_Y
172
173 Integer :: Mud_P
174 Real , Allocatable : : MaxPlugR_Tot ( : )
175
176 Integer : : HB_No , BH_No
177 ! C o u n t s t h e number o f s a m p l e s t h a t t h e f l u i d model i s t h e b e s t f i t .
178 Integer :: NoFluid_No
179 ! C o u n t s t h e number o f t i m e s t h e f l u i d d a t a was m i s s i n g o r i n c o m p l e t e .
180 Integer : : DeltaWBH1_No , DeltaWBH2_No
181 Integer : : DeltaWHB1_No , DeltaWHB2_No
182
136 E. Code of the SampleSource Program

183 Real :: S o u r c e D e p t h , SourceAway , S o u r c e R i g h t


184 Real , Allocatable : : S o u r c e D e p t h T o t ( : ) , SourceAwayTot ( : ) , S o u r c e R i g h t T o t ( : )
185
186 Real :: S a m p l i n g D e p t h , SamplingAway , S a m p l i n g R i g h t
187 Real , Allocatable : : S a m p l i n g D e p t h T o t ( : ) , SamplingAwayTot ( : ) , S a m p l i n g R i g h t T o t ( : )
188
189 Character (1000) :: Message
190
191 Integer :: EndOption
192
193 ! Sieve Related
194 Real , Allocatable : : D ( : , : ) , D_V ( : , : )
195 Character (14) , Allocatable :: Sieve_Code ( : )
196 ! C o n t a i n s c o d e s from b o t h s i d e s s o t h e s h o r t e r o n e s w i l l h a v e s p a c e s a t t h e end .
197 Character (14) , Allocatable :: Sieve_Code_V ( : )
198 Real : : D90 , D15
199 Real :: Rho_Inflow
200 ! Real :: Rho_Grain
201
202 Real :: Loss_BH , Loss_HB
203 Real :: LossPercentage_BH , LossPercentage_HB
204 Real , Allocatable : : InfiltrationLossBTL_BH_Tot ( : ) , InfiltrationLossBTL_HB_Tot ( : )
205 Real , Allocatable : : InfilLossPerc_BH_Tot ( : ) , InfilLossPerc_HB_Tot ( : )
206
207 ! Max diameter
208 Real :: D_Max
209 Real , Allocatable : : D_Max_Tot ( : )
210 Real :: v
211 Real , Allocatable : : VArr ( : )
212 Integer :: VArrCountN0
213 Real :: AverageV
214 Real , Allocatable : : AverageV_Tot ( : )
215 Real :: MaxV
216 Real , Allocatable : : MaxV_Tot ( : )
217
218 Real :: Temp1
219 Real :: VolSol
220 Real :: Max_d_BH , c1 , v _ s e t t l e _ B H
221 Real , Allocatable : : Max_d_BH_Tot ( : ) , v _ s e t t l e _ B H _ T o t ( : )
222
223 Real :: Gamma_Ann1 , Gamma_Ann2 , Eff_Visc_HB , Re_HB2
224 Real , Allocatable : : Gamma_Ann_Tot1 ( : ) , Gamma_Ann_Tot2 ( : ) , E f f _ V i s c _ H B _ T o t ( : ) , Re_HB2_Tot ( : )
225
226 Real :: DeltaWeightBH1 , DeltaWeightBH2
227 Real :: DeltaWeightHB1 , DeltaWeightHB2
228
229 Real : : Re_Gen_BH , Re_Gen_HB
230 Real , A l l o c a t a b l e : : Re_Gen_BH_Tot ( : ) , Re_Gen_HB_Tot ( : )
231
232 Real : : DmaxTrMinBH , DmaxTrMinHB , DmaxTrMaxBH , DmaxTrMaxHB
233 Real , A l l o c a t a b l e : : DmaxTrMinBH_Tot ( : ) , DmaxTrMinHB_Tot ( : ) , DmaxTrMaxBH_Tot ( : ) ,
DmaxTrMaxHB_Tot ( : )
234
235 ! −−−−−−−−−−−−−−−−−−−−−−
236 ! START PROGRAM
237 ! −−−−−−−−−−−−−−−−−−−−−−
238 ScenarioNo = 1
239 FullRunCounter = 0
240
241 100 C o n t i n u e
242
243 W r i t e ( * , ’ (A) ’ ) " Give a P r o g r a m O p t i o n , o r p r e s s ’ 0 ’ f o r more i n f o r m a t i o n : "
244 Read ( * , ’ ( I ) ’ ) ProgramOption
245 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
246
247 S e l e c t Case ( P r o g r a m O p t i o n )
248
249 Case ( 0 )
250
251 Write ( * , * )
137

252 W r i t e ( * , ’ (A) ’ ) " P r o g r a m O p t i o n 1 e x e c u t e s o n c e f o r e i t h e r T e x e l o r Den H e l d e r , l o s s and


diameter are screen input . "
253 W r i t e ( * , ’ (A) ’ ) " P r o g r a m O p t i o n 2 r u n s 9 d i f f e r e n t s c e n a r i o s f o r one l o c a t i o n . "
254 W r i t e ( * , ’ (A) ’ ) " P r o g r a m O p t i o n 3 e x e c u t e s 2 s c e n a r i o s from s c r e e n i n p u t . 1 s c e n a r i o i s
p o s s i b l e by p u t t i n g ’ 0 ’ a s s e c o n d s c e n a r i o . "
255 W r i t e ( * , ’ (A) ’ ) " P r o g r a m O p t i o n 4 r u n s a l l s c e n a r i o s f o r b o t h l o c a t i o n s . "
256 Write ( * , * )
257 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
258 Go t o 100
259
260 Case ( 1 )
261
262 W r i t e ( * , ’ (A) ’ ) " Give t h e l o c a t i o n , e i t h e r ’ T e x e l ’ o r ’ Den H e l d e r ’ , most a b b r e v i a t i o n s
are recognized : "
263 Read ( * , ’ (A) ’ ) Location
264 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
265
266 300 C o n t i n u e ! Redo , i n c o r r e c t i n p u t
267
268 W r i t e ( * , ’ (A) ’ ) " Give a l o s s p e r c e n t a g e , i n t h e f o l l o w i n g f o r m a t ‘0.00 ’: "
269 Read ( * , ’ ( F4 . 2 ) ’ ) Loss_P
270
271 W r i t e ( * , ’ (A) ’ ) " Give a d i a m e t e r f o r t h e b o r e h o l e , i n [m] and t h e f o r m a t ‘0.00 ’: "
272 Read ( * , ’ ( F4 . 2 ) ’ ) D_bh
273
274 W r i t e ( * , ’ (A, F4 . 2 ) ’ ) " Loss_P : " , Loss_P
275 W r i t e ( * , ’ (A, F4 . 2 ) ’ ) " D_bh : " , D_bh
276
277 I f ( Loss_P >= 0 . 7 5 d0 . o r . Loss_P < 0 . 0 d0 . o r . D_bh < 0 . 0 d0 . o r . D_bh > 1 . 0 d0 ) Then
278 W r i t e ( * , ’ ’ ) " The g i v e n i n p u t i s u n r e a l i s t i c o r n o t t e s t e d , p l e a s e t r y a g a i n . "
279 Go To 300
280 End I f
281
282 200 C o n t i n u e ! Redo , i n c o r r e c t r u n o p t i o n
283
284 W r i t e ( * , ’ (A) ’ ) " Give p r o g r a m e x e c u t e o p t i o n , ’ 1 ’ = f a s t , ’ 2 ’ = f u l l : "
285 Read ( * , ’ ( I ) ’ ) RunOption
286
287 S e l e c t Case ( RunOption )
288
289 Case ( 1 )
290
291 W r i t e ( Message , ’ (A, I 2 . 2 ) ’ ) " The l o c a t i o n i s " / / t r i m ( L o c a t i o n ) / / " and t h e f a s t o p t i o n
with minimal f i l e o u t p u t i s chosen . "
292
293 Case ( 2 )
294
295 W r i t e ( Message , ’ (A, I 2 . 2 ) ’ ) " The l o c a t i o n i s " / / t r i m ( L o c a t i o n ) / / " and t h e f u l l o p t i o n
w i t h maximum no . o f o u t p u t f i l e s i s c h o s e n . "
296
297 Case D e f a u l t
298
299 W r i t e ( * , ’ (A) ’ ) " Unknown RunOption , p l e a s e t r y a g a i n . "
300 Go To 200
301
302 End S e l e c t
303
304 C a l l W r i t e L o g ( 2 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
305 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
306
307 Case ( 2 )
308
309 W r i t e ( * , ’ (A) ’ ) " Give t h e l o c a t i o n , e i t h e r ’ T e x e l ’ o r ’ Den H e l d e r ’ , most a b b r e v i a t i o n s
are recognized : "
310 Read ( * , ’ (A) ’ ) Location
311 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
312
138 E. Code of the SampleSource Program

313 RunOption = 1
314
315 Case ( 3 )
316
317 W r i t e ( * , ’ (A) ’ ) " I f only 1 s c e n a r i o i s p r e f e r e d , put ’0 ’ f o r t h e second s c e n a r i o . "
318 W r i t e ( * , ’ (A) ’ ) " Give t h e f i r s t s c e n a r i o : "
319 Read ( * , ’ ( I ) ’ ) ScenarioNo1
320 W r i t e ( * , ’ (A) ’ ) " Give t h e s e c o n d s c e n a r i o : "
321 Read ( * , ’ ( I ) ’ ) ScenarioNo2
322
323 ScenarioNo = ScenarioNo1
324
325 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
326
327 W r i t e ( * , ’ (A) ’ ) " Give t h e l o c a t i o n , e i t h e r ’ T e x e l ’ o r ’ Den H e l d e r ’ , most a b b r e v i a t i o n s
are recognized : "
328 Read ( * , ’ (A) ’ ) Location
329 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
330
331 RunOption = 1
332
333 Case ( 4 )
334
335 W r i t e ( * , ’ (A) ’ ) " Give t h e f i r s t l o c a t i o n , e i t h e r ’ T e x e l ’ o r ’ Den H e l d e r ’ , most
abbreviations are recognized : "
336 Read ( * , ’ (A) ’ ) Location
337 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
338
339 ScenarioNo = 1
340 RunOption = 1
341
342 End S e l e c t
343
344 500 C o n t i n u e ! S t a r t S c e n a r i o Loop
345
346 S e l e c t Case ( L o c a t i o n )
347 ! M u l t i p l e a b b r e v i a t i o n s c a n be u s e d
348 Case ( ’ Den H e l d e r ’ , ’ den h e l d e r ’ , ’DH’ , ’ dh ’ , ’Dh ’ )
349
350 Location = ’ Den H e l d e r ’
351 ! T h i s i s t h e name t h a t i s a l s o p u t i n t h e g r a p h s and f i l e names .
352 Open ( SampleData , f i l e = f i l e f o l d e r _ i n / / " SampleData_DH . c s v " )
353
354 Open ( InputDim , f i l e = f i l e f o l d e r _ i n / / " InputDim_DH . INP " )
355
356 Open ( InputCSV_PD , f i l e = f i l e f o l d e r _ i n / / " InputData_PD_DH . c s v " ) ! The f i l e a s
d o w n l o a d e d from P r o D a t a b u t t i t e l s ( e x c e p t f o r f i r s t l i n e ) a r e removed a s w e l l a s t h e
q u o t a t i o n marks a r o u n d e a c h t e r m .
357
358 Open ( InputCSV_Sur , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_DH_Total . csv " ) ! All survey
d a t a , from DH, combined i n t o one f i l e .
359
360 Open ( InputMP , f i l e = f i l e f o l d e r _ i n / / " Input_MP_DH . c s v " ) ! Contains the
a n n u l a r m u d p r e s s u r e s p e r j o i n t no .
361
362 Case ( ’ T e x e l ’ , ’ t e x e l ’ , ’TXL ’ , ’ t x l ’ , ’T ’ , ’ t ’ )
363
364 Location = ’ Texel ’
365
366 Open ( SampleData , f i l e = f i l e f o l d e r _ i n / / " SampleData_Texel . csv " )
367
368 Open ( InputDim , f i l e = f i l e f o l d e r _ i n / / " I n p u t D i m _ T e x e l . INP " )
369
370 Open ( InputCSV_PD , f i l e = f i l e f o l d e r _ i n / / " InputData_PD_Texel_V2 . csv " ) ! The
v a l u e s o f t h i s f i l e a r e c a l i b r a t e d a f t e r w a r d s and r o u n d e d , t h e e r r o r t h i s c a u s e s i s
s o p p o s e d t o be o f l i m i t e d i n f l u e n c e c o n s i d e r i n g t h e o t h e r u n c e r t a i n t i e s .
371
372 Open ( InputCSV_Sur , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_Texel_Total . csv " ) ! All
139

s u r v e y d a t a , from T e x e l , combined i n t o one f i l e .


373
374 Open ( InputMP , f i l e = f i l e f o l d e r _ i n / / " Input_MP_T . c s v " ) ! Contains the
a n n u l a r m u d p r e s s u r e s p e r j o i n t no .
375
376 Case D e f a u l t
377 Write ( * , * )
378 W r i t e ( * , ’ (A) ’ ) " The g i v e n l o c a t i o n i s n o t r e c o g n i z e d , p l e a s e s t a r t a g a i n . "
379 Write ( * , * )
380 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
381 Go t o 100
382
383 End S e l e c t
384
385 Open ( S i e v e R e s u l t s , f i l e = f i l e f o l d e r _ i n / / " S i e v e R e s u l t s . csv " ) ! This f i l e c o n t a i n s
t h e d a t a from b o t h l o c a t i o n s .
386
387 ! −−−−−−−−−−−−−−−−−−−−−−
388 ! Reading f i l e s
389 ! −−−−−−−−−−−−−−−−−−−−−−
390
391 C a l l ReadingFileCSV_PD ( InputCSV_PD , DateTime_PD , Bit_DPT , Hol_DPT , Car_POS , Car_SPD , P u l l , Push ,
Torq_pos , Rot_SPD , M_Press , MudFlw , Torq_neg , P r e s s _ 1 , P r e s s _ 2 , P r e s s _ 3 , HS_D , N l i n e s _ P D )
392
393 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A1"
394 ! I f RunOption = 2 , f u l l run , a l l c h e c k m e s s a g e s a r e shown a s w e l l .
395 C a l l R e a d i n g F i l e C S V _ S u r ( InputCSV_Sur , N l i n e s _ s u r , DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w ,
AzimuthRaw , B t o t , Dip , E l e v a t i o n C a l c , ElevationMGS , Away , R_Calc , R_MGS)
396
397 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A2"
398
399 C a l l R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , SampleData , No_Samples , DateTime_Samples , Sample_ID , Temp , EC ,
pH , MF, Rho_Bf , SC , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s , Gel10min
)
400
401 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A3"
402
403 I f ( t r i m ( L o c a t i o n ) == ’ Den H e l d e r ’ ) Then
404 C a l l R e a d i n g F i l e M P ( InputMP , L o c a t i o n , Nlines_MP , A c t i v i t y , Joint_MP , Length_MP , P_Max1 , P_Max2 ,
P_Calc , P _ R e a l )
405 E l s e I f ( t r i m ( L o c a t i o n ) == ’ T e x e l ’ ) Then
406 C a l l R e a d i n g F i l e M P ( InputMP , L o c a t i o n , Nlines_MP , A c t i v i t y , Joint_MP , Length_MP , P_Real , P_Min )
407 End i f
408
409 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A4"
410
411 C a l l R e a d i n g F i l e S i e v e ( S i e v e R e s u l t s , Sieve_Code , D)
412
413 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A5"
414
415 ! C a l l R e a d i n g F i l e S i e v e ( S i e v e R e s u l t s _ V , Sieve_Code_V , D_V)
416
417 ! I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A6"
418
419 ! −−−−−−−−−−−−−−−−−−−−−−
420 ! Dimensions & Conversions t o SI
421 ! −−−−−−−−−−−−−−−−−−−−−−
422
423 Read ( InputDim , * ) ! F i r s t l i n e c o n t a i n s t h e l o c a t i o n , l o c a t i o n i s a l r e a d y g i v e n by
s c r e e n i n p u t i n o r d e r t o know which f i l e s a r e t o be r e a d , s o t h i s i s r e d u n d a n t .
424
425 S e l e c t Case ( L o c a t i o n )
426
427 Case ( ’ Den H e l d e r ’ )
428
429 Read ( InputDim , * ) D_drillbit ! [mm]
430 D _ d r i l l b i t = D _ d r i l l b i t /1000 ! [mm] t o [m]
431
432 Read ( InputDim , * ) D_ds ! [mm]
433 D_ds = D_ds / 1 0 0 0 ! [mm] t o [m]
140 E. Code of the SampleSource Program

434 Read ( InputDim , * ) Thickness_ds ! [mm]


435 Thickness_ds = Thickness_ds /1000 ! [mm] t o [m]
436
437 Read ( InputDim , * ) Length_Pipe ! [m]
438 Read ( InputDim , * ) Length_BHA ! [m]
439
440 Read ( InputDim , * ) Planned_Azimuth ! [o]
441 Read ( InputDim , * ) Rho_Inflow ! [ −]
442 Rho_Inflow = R h o _ I n f l o w * 1000 ! [ kg / m3 ]
443
444 Read ( InputDim ,*)
445 Read ( InputDim ,*) Conversion_Degr_Pa ! [ −]
446 Read ( InputDim ,*) Conversion_Degr_lb
447 Read ( InputDim ,*) Conversion_lb_Pa
448 Read ( InputDim ,*) Conversion_RPM_PerS ! [ −]
449
450 Case ( ’ T e x e l ’ )
451
452 Read ( InputDim , * ) D_drillbit ! [mm]
453 D _ d r i l l b i t = D _ d r i l l b i t /1000 ! [mm] t o [m]
454
455 Read ( InputDim , * ) D_ds ! [mm]
456 D_ds = D_ds / 1 0 0 0 ! [mm] t o [m]
457 Read ( InputDim , * ) Thickness_ds ! [mm]
458 Thickness_ds = Thickness_ds /1000 ! [mm] t o [m]
459
460 Read ( InputDim , * ) Length_Pipe ! [m]
461 Read ( InputDim , * ) Length_BHA ! [m]
462
463 Read ( InputDim , * ) Planned_Azimuth ! [o]
464 Read ( InputDim , * ) Rho_Inflow ! [ −]
465 Rho_Inflow = R h o _ I n f l o w * 1000 ! [ kg / m3 ]
466
467 Read ( InputDim ,*)
468 Read ( InputDim ,*) Conversion_Degr_Pa ! [ −]
469 Read ( InputDim ,*) Conversion_Degr_lb
470 Read ( InputDim ,*) Conversion_lb_Pa
471 Read ( InputDim ,*) Conversion_RPM_PerS ! [ −]
472
473 Case D e f a u l t
474
475 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n i s u n f a m i l i a r and t h u s t h e i n p u t f i l e can ’ t be r e a d p r o p e r l y . "
476 Read ( * , * )
477 Stop
478
479 End S e l e c t
480
481 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check A7"
482
483 I f ( ( P r o g r a m O p t i o n == 2 ) . o r . ( P r o g r a m O p t i o n == 3 ) . o r . ( P r o g r a m O p t i o n == 4 ) ) Then
484
485 S e l e c t Case ( S c e n a r i o N o )
486
487 Case ( 1 ) ! S m a l l e s t d i a m e t e r , no l o s s
488 Loss_P = 0 . d0
489 D_bh = 1 . 1 d0 * D _ d r i l l b i t
490
491 Write ( * , * )
492 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
493
494 Case ( 2 ) ! Smallest diameter , t e s t loss
495 Loss_P = 0 . 0 7 d0
496 D_bh = 1 . 1 d0 * D _ d r i l l b i t
497
498 Write ( * , * )
499 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
500
501 Case ( 3 ) ! S m a l l e s t d i a m e t e r , 30% l o s s
502 Loss_P = 0 . 3 0 d0
141

503 D_bh = 1 . 1 d0 * D _ d r i l l b i t
504
505 Write ( * , * )
506 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
507
508 Case ( 4 ) ! Medium d i a m e t e r , no l o s s
509 Loss_P = 0 . d0
510 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 4 0 d0
511 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 4 5 d0
512
513 Write ( * , * )
514 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
515
516 Case ( 5 ) ! Medium d i a m e t e r , t e s t l o s s
517 Loss_P = 0 . 0 7 d0
518 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 4 0 d0
519 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 4 5 d0
520
521 Write ( * , * )
522 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
523
524 Case ( 6 ) ! Medium d i a m e t e r , 30% l o s s
525 Loss_P = 0 . 3 0 d0
526 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 4 0 d0
527 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 4 5 d0
528
529 Write ( * , * )
530 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
531
532 Case ( 7 ) ! L a r g e d i a m e t e r , no l o s s
533 Loss_P = 0 . d0
534 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 5 5 d0
535 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 8 0 d0
536
537 Write ( * , * )
538 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
539
540 Case ( 8 ) ! Large diameter , t e s t l o s s
541 Loss_P = 0 . 0 7 d0
542 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 5 5 d0
543 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 8 0 d0
544
545 Write ( * , * )
546 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
547
548 Case ( 9 ) ! L a r g e d i a m e t e r , 30% l o s s
549 Loss_P = 0 . 3 0 d0
550 I f ( L o c a t i o n == ’ T e x e l ’ ) D_bh = 0 . 5 5 d0
551 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D_bh = 0 . 8 0 d0
552
553 Write ( * , * )
554 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
555
556 Case D e f a u l t
557
558 Write ( * , * )
559 W r i t e ( * , ’ (A) ’ ) " S o m e t h i n g went wrong . "
560 Write ( * , * )
561 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
562 Read ( * , * )
563 Stop
564
565 End S e l e c t
142 E. Code of the SampleSource Program

566
567 End I f
568
569
570 I f ( P r o g r a m O p t i o n == 2 . o r . P r o g r a m O p t i o n == 3 . o r . P r o g r a m O p t i o n == 4 ) Then
571
572 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t S a m p l e s _ S c e n a r i o _ " , S c e n a r i o N o , " .
csv "
573 Open ( O u t p u t S a m p l e s , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
574 W r i t e ( O u t p u t S a m p l e s , ’ (A) ’ ) " D a t e Time ; Sample Code ; MainI ; SourceLocAv [m] ;
S a m p l i n g D e p t h T o t ; SamplingAwayTot ; S a m p l i n g R i g h t T o t ; S o u r c e D e p t h T o t ; SourceAwayTot ;
S o u r c e R i g h t T o t ; P o s i t i o n B i t A l l [m] ; Pumptime [ s ] ; HB Tau Y i e l d ; HB K ; HB n [ − ] ;
Alpha ; D e l t a HB ; PV [ Pa . s ] ; YP [ Pa ] ; D e l t a Bingham ; Mud P r e s s u r e A n n u l u s [ Pa ] ;
Maximum P l u g Flow R a d i u s [m] ; T r a n s p o r t P a r a m e t e r BH ; T r a n s p o r t P a r a m e t e r HB ; A v e r a g e
v e l o c i t y [m/ s ] ; Max D i a m e t e r S u s p e n s i o n ; Re_BH ; Re_HB ; Mu_HB ; He_BH ; Max_d_BH ;
v_settle_BH "
575
576 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t S a m p l e s L o c _ S c e n a r i o _ " , S c e n a r i o N o ,
" . txt "
577 Open ( O u t p u t S a m p l e s L o c , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
578 W r i t e ( O u t p u t S a m p l e s L o c , ’ (A) ’ ) " Sample_Code , DateTimeSample , SamplingAway , S a m p l i n g D e p t h
, S a m p l i n g R i g h t , SourceAway , S o u r c e D e p t h , S o u r c e R i g h t "
579
580 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ F l u i d P r o p e r t i e s _ S c e n a r i o _ " , S c e n a r i o N o , "
. csv "
581 Open ( O u t p u t F l u i d P r o p e r t i e s , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
582 W r i t e ( O u t p u t F l u i d P r o p e r t i e s , ’ (A) ’ ) " Sample_Code ; DateTimeSample ; HB Tau Y i e l d ; HB K
; HB n [ − ] ; Alpha ; D e l t a HB ; PV [ Pa . s ] ; YP [ Pa ] ; D e l t a Bingham "
583
584 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ F l u i d P r o p T e x _ S c e n a r i o _ " , S c e n a r i o N o , " .
txt "
585 Open ( O u t p u t F l u i d P r o p T e x , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
586 W r i t e ( O u t p u t F l u i d P r o p T e x , ’ (A) ’ ) " Sample_Code , DateTimeSample , HB Tau Y i e l d , HB K, HB n
[ − ] , Alpha , D e l t a HB, PV [ Pa . s ] , YP [ Pa ] , D e l t a Bingham "
587
588 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t L o s s e s _ S c e n a r i o _ " , S c e n a r i o N o , " .
csv "
589 Open ( O u t p u t L o s s e s , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
590 W r i t e ( O u t p u t L o s s e s , ’ (A) ’ ) " Sample Code ; Loss_P [%] ; I n f i l L o s s P e r c _ B H [%] ;
I n f i l L o s s P e r c _ H B [%] "
591
592 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ T r a n s p o r t P r o p e r t i e s _ S c e n a r i o _ " ,
ScenarioNo , " . csv "
593 Open ( O u t p u t T r a n s p o r t P r o p e r t i e s , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
594 W r i t e ( O u t p u t T r a n s p o r t P r o p e r t i e s , ’ (A) ’ ) " Sample_Code ; DateTimeSample ; MaxPlugR ;
AverageV ; D_Max ; S h e a r R a t e Downhole1 [ 1 / s ] ; S h e a r R a t e Downhole2 [ 1 / s ] ; Re_Gen_BH ;
Re_Gen_HB ; D90 Sample ; Dmax BH Min ; Dmax BH Max ; Dmax HB Min ; Dmax HB Max ;
DeltaWeightBH1 ; DeltaWeightBH2 ; DeltaWeightHB1 ; DeltaWeightHB2 "
595
596 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ T r a n s p o r t P r o p T e x _ S c e n a r i o _ " , S c e n a r i o N o ,
" . txt "
597 Open ( O u t p u t T r a n s p o r t P r o p T e x , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
598 W r i t e ( O u t p u t T r a n s p o r t P r o p T e x , ’ (A) ’ ) " Sample_Code , DateTimeSample , MaxPlugR , AverageV ,
D_Max , S h e a r R a t e Downhole1 [ 1 / s ] , S h e a r R a t e Downhole2 [ 1 / s ] , E f f V i s c HB, Re_Gen_BH ,
Re_Gen_HB , D90 Sample , Dmax BH Min , Dmax BH Max , Dmax HB Min , Dmax HB Max , DeltaWeightBH1
, DeltaWeightBH2 , DeltaWeightHB1 , DeltaWeightHB2 "
599
600 W r i t e ( Name , ’ (A, I 2 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ S a m p l e S o u r c e L o g _ S c e n a r i o _ " , S c e n a r i o N o , "
. txt "
601 Open ( SampleSourceLog , f i l e = f i l e f o l d e r _ o u t / / t r i m ( Name ) )
602
603 Else
604
605 W r i t e ( Name , ’ (A, F4 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t S a m p l e s _ " , D_Bh , " − " , Loss_P , " . c s v "
! I n c l u d e s t h e r e s u l t s o f t h e main do l o o p , s o r e s u l t s o f a l l c a l c u l a t i o n and o f
a l l samples . . .
606 Open ( O u t p u t S a m p l e s , f i l e = f i l e f o l d e r _ o u t _ 1 / / t r i m ( Name ) )
607 W r i t e ( O u t p u t S a m p l e s , ’ (A) ’ ) " D a t e Time ; Sample Code ; MainI ; SourceLocAv [m] ;
S a m p l i n g D e p t h T o t ; SamplingAwayTot ; S a m p l i n g R i g h t T o t ; S o u r c e D e p t h T o t ; SourceAwayTot ;
S o u r c e R i g h t T o t ; P o s i t i o n B i t A l l [m] ; Pumptime [ s ] ; HB Tau Y i e l d ; HB K ; HB n [ − ] ;
Alpha ; D e l t a HB ; PV [ Pa . s ] ; YP [ Pa ] ; D e l t a Bingham ; Mud P r e s s u r e A n n u l u s [ Pa ] ;
143

Maximum P l u g Flow R a d i u s [m] ; T r a n s p o r t P a r a m e t e r BH ; T r a n s p o r t P a r a m e t e r HB ; A v e r a g e


v e l o c i t y [m/ s ] ; Max D i a m e t e r S u s p e n s i o n ; Re_BH ; Re_HB ; Mu_HB ; He_BH ; Max_d_BH ;
v_settle_BH "
608
609 W r i t e ( Name , ’ (A, F4 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t S a m p l e s L o c _ " , D_Bh , " − " , Loss_P , " .
txt "
610 Open ( O u t p u t S a m p l e s L o c , f i l e = f i l e f o l d e r _ o u t _ 1 / / t r i m ( Name ) )
611 W r i t e ( O u t p u t S a m p l e s L o c , ’ (A) ’ ) " Sample_Code , DateTimeSample , SamplingAway , S a m p l i n g D e p t h
, S a m p l i n g R i g h t , S o u r c e D e p t h , SourceAway , S o u r c e R i g h t "
612
613 W r i t e ( Name , ’ (A, F4 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ O u t p u t L o s s e s _ " , D_Bh , " − " , Loss_P , " . c s v "
614 Open ( O u t p u t L o s s e s , f i l e = f i l e f o l d e r _ o u t _ 1 / / t r i m ( Name ) )
615 W r i t e ( O u t p u t L o s s e s , ’ (A) ’ ) " Sample Code ; Loss_P [%] ; I n f i l L o s s P e r c _ B H [%] ;
I n f i l L o s s P e r c _ H B [%] "
616
617 W r i t e ( Name , ’ (A, F4 . 2 ,A) ’ ) Trim ( S h o r t ( L o c a t i o n ) ) / / " _ S a m p l e S o u r c e L o g _ " , D_Bh , " − " , Loss_P , " . t x t
"
618 Open ( SampleSourceLog , f i l e = f i l e f o l d e r _ o u t _ 1 / / t r i m ( Name ) )
619
620 I f ( RunOption == 2 ) Open ( TableHans , f i l e = f i l e f o l d e r _ o u t / / " TableHans_ " / / t r i m ( S h o r t (
Location ) ) / / " . csv " )
621 I f ( RunOption == 2 ) W r i t e ( TableHans , ’ (A) ’ ) " Sample_Code ; S i e v e _ C o d e ; Sample Time Away ;
S o u r c e Away ; Sample Time L e n g t h ; S o u r c e L e n g t h ; Sample Time Depth ; S o u r c e Depth "
622
623 End I f
624
625 ! Have t o be o p e n e d anyway , s i n c e i t c o n t a i n s t h e d a t a from b o t h l o c a t i o n s
626
627 ! Open ( S i e v e R e s u l t s _ V , f i l e = f i l e f o l d e r _ i n / / " SieveResults_V . csv " )
628
629 ! −−−−−−−−−−−−−−−−−−−−−−
630 ! P r e p a r a t i o n s Main Loop
631 ! −−−−−−−−−−−−−−−−−−−−−−
632 ! D e c l a r i n g t h e LogGamma v a l u e s t o be u s e d i n d e t e r m i n i n g t h e HB p a r a m e t e r s
633
634 GammaY ( 1 ) = 3 . d0 * Conversion_RPM_PerS
635 GammaY ( 2 ) = 6 . d0 * Conversion_RPM_PerS
636 GammaY ( 3 ) = 3 0 . d0 * Conversion_RPM_PerS
637 GammaY ( 4 ) = 6 0 . d0 * Conversion_RPM_PerS
638 GammaY ( 5 ) = 1 0 0 . d0 * Conversion_RPM_PerS
639 GammaY ( 6 ) = 2 0 0 . d0 * Conversion_RPM_PerS
640 GammaY ( 7 ) = 3 0 0 . d0 * Conversion_RPM_PerS
641 GammaY ( 8 ) = 6 0 0 . d0 * Conversion_RPM_PerS
642
643 Do i = 1 , s i z e (GammaY)
644 LogGamma ( i ) = Log10 (GammaY( i ) )
645 End Do
646
647 C a l l GeometryBoreH ( PI , D_bh , D_ds , A_bh , A_ds , A _ a n n u l u s )
648
649 HB_No = 0 . d0 ! I n t i a l values for counters .
650 BH_No = 0 . d0
651
652 DeltaWBH1_No = 0 . d0
653 DeltaWBH2_No = 0 . d0
654 DeltaWHB1_No = 0 . d0
655 DeltaWHB2_No = 0 . d0
656
657 NoFluid_No = 0 . d0
658
659 A l l o c a t e ( PumpTimesAll ( No_Samples ) ) ! Enables a v i s u a l check
660 A l l o c a t e ( T i m e I n t A v A l l ( No_Samples ) ) ! ""
661 A l l o c a t e ( S o u r c e L o c A v A l l ( No_Samples ) ) ! C o l l e c t s t h e v a l u e from e v e r y r u n o f t h e l o o p .
662 A l l o c a t e ( P o s i t i o n B i t A l l ( No_Samples ) ) ! Required f o r the lag diagram .
663 A l l o c a t e ( Tau_Yield_HB_Tot ( No_Samples ) )
664 A l l o c a t e ( K_Tot ( No_Samples ) )
665 A l l o c a t e ( n _ T o t ( No_Samples ) )
666 A l l o c a t e ( PV_Tot ( No_Samples ) )
667 A l l o c a t e ( YP_Tot ( No_Samples ) )
668 A l l o c a t e ( A l p h a _ T o t ( No_Samples ) )
669 A l l o c a t e ( Delta_Tot_HB ( No_Samples ) )
144 E. Code of the SampleSource Program

670 A l l o c a t e ( Delta_Tot_BH ( No_Samples ) )


671 A l l o c a t e ( Mud_P_Tot ( No_Samples ) )
672 A l l o c a t e ( MaxPlugR_Tot ( No_Samples ) )
673
674 A l l o c a t e ( S a m p l i n g D e p t h T o t ( No_Samples ) )
675 A l l o c a t e ( SamplingAwayTot ( No_Samples ) )
676 A l l o c a t e ( S a m p l i n g R i g h t T o t ( No_Samples ) )
677
678 A l l o c a t e ( S o u r c e D e p t h T o t ( No_Samples ) )
679 A l l o c a t e ( SourceAwayTot ( No_Samples ) )
680 A l l o c a t e ( S o u r c e R i g h t T o t ( No_Samples ) )
681
682 A l l o c a t e ( I n f i l t r a t i o n L o s s B T L _ B H _ T o t ( No_Samples ) )
683 A l l o c a t e ( I n f i l t r a t i o n L o s s B T L _ H B _ T o t ( No_Samples ) )
684 A l l o c a t e ( I n f i l L o s s P e r c _ B H _ T o t ( No_Samples ) )
685 A l l o c a t e ( I n f i l L o s s P e r c _ H B _ T o t ( No_Samples ) )
686
687 A l l o c a t e ( D_Max_Tot ( No_Samples ) )
688
689 A l l o c a t e ( AverageV_Tot ( No_Samples ) )
690 A l l o c a t e ( MaxV_Tot ( No_Samples ) )
691
692 A l l o c a t e ( Max_D_BH_Tot ( No_Samples ) )
693 A l l o c a t e ( v _ s e t t l e _ B H _ T o t ( No_Samples ) )
694
695 A l l o c a t e ( Gamma_Ann_Tot1 ( No_Samples ) )
696 A l l o c a t e ( Gamma_Ann_Tot2 ( No_Samples ) )
697 A l l o c a t e ( Re_Gen_BH_Tot ( No_Samples ) )
698 A l l o c a t e ( Re_Gen_HB_Tot ( No_Samples ) )
699
700 A l l o c a t e ( DmaxTrMinBH_Tot ( No_Samples ) )
701 A l l o c a t e ( DmaxTrMinHB_Tot ( No_Samples ) )
702 A l l o c a t e ( DmaxTrMaxBH_Tot ( No_Samples ) )
703 A l l o c a t e ( DmaxTrMaxHB_Tot ( No_Samples ) )
704
705 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 "
706
707 ! −−−−−−−−−−−−−−−−−−−−−−
708 ! START MAIN LOOP
709 ! −−−−−−−−−−−−−−−−−−−−−−
710
711 M a i n l o o p : Do MainI = 1 , No_Samples
712
713 Write ( * , * )
714 W r i t e ( Message , ’ (A, I 2 . 2 , A, I 2 . 2 , A, I 2 . 2 , A, A) ’ ) t r i m ( L o c a t i o n ) / / " S c e n a r i o " , ScenarioNo , " , " ,
MainI , " / " , No_Samples , " Sample No . " , Sample_ID ( MainI ) ! Shows p r o g r e s s o f t h e
program t h r o u g h t h e sample l i s t .
715 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
716 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
717
718 ! Open ( SampleLog , f i l e = f i l e f o l d e r _ o u t / / " Log_ " / / t r i m ( L o c a t i o n ) / / " _ " / / t r i m ( Sample_ID ( MainI ) )
/ / " . txt ")
719 ! W r i t e ( Message , ’ ( A, A, A) ’ ) t r i m ( L o c a t i o n ) , " " , t r i m ( Sample_ID ( MainI ) )
720 ! C a l l W r i t e L o g ( 3 , Message , SampleLog )
721
722 DateTimeSample = D a t e T i m e _ S a m p l e s ( MainI )
723
724 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 . 1 "
725
726 Sample_Code = Sample_ID ( MainI )
727
728 C a l l F i n d D a t e T i m e V a l u e A p p r o x ( DateTimeSample , DateTime_PD , Index_PD )
729 ! F i n d s t h e s a m p l e d a t e and t i m e i n t h e P r o D a t a f i l e .
730 C a l l F i n d A p p r o x D a t e T i m e ( DateTimeSample , DateTime_Sur , I n d e x _ S u r )
731 ! F i n d s t h e s a m p l e d a t e and t i m e i n t h e s u r v e y f i l e .
732
733 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 . 2 "
734
735 C a l l S a m p l i n g L o c a t i o n ( I n d e x _ S u r , E l e v a t i o n C a l c , Away , R_Calc , S a m p l i n g D e p t h , SamplingAway ,
SamplingRight )
145

736
737 ! F i l l i n g the vector c o n t a i n i n g the r e s u l t s of a l l the samples .
738 S a m p l i n g D e p t h T o t ( MainI ) = SamplingDepth
739 SamplingAwayTot ( MainI ) = SamplingAway
740 S a m p l i n g R i g h t T o t ( MainI ) = SamplingRight
741
742 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
743 ! C a l c u l a t i o n s − Main
744 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
745 ! Fluid Parameters
746 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
747
748 I f ( RPM_600 ( MainI ) <= 0 . o r . RPM_300 ( MainI ) <= 0 . o r . RPM_200 ( MainI ) <= 0 . o r . RPM_100 ( MainI )
<= 0 . o r . RPM_60 ( MainI ) <= 0 . o r . RPM_30 ( MainI ) <= 0 . o r . RPM_6 ( MainI ) <= 0 . o r . RPM_3 (
MainI ) <= 0 ) Then
749
750 FluidData = ’No ’ ! D e f i n i t i o n of the FluidData case .
751
752 W r i t e ( Message , ’ (A) ’ ) " F l u i d d a t a i s missing or incomplete , f l u i d p r o p e r t i e s couldn ’ t
be d e t e r m i n e d . "
753 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
754
755 NoFluid_No = NoFluid_No + 1 ! C o u n t e r t h a t k e e p s t r a c k o f t h e amount o f
samples with , m i s s i n g or i n c o m p l e t e r d a t a .
756
757 ! N e c e s s a r y o r p r o g r a m s t a r t a s s i g n i n g i t s own v a l u e s t o t h e v a r i a b l e s .
758 Tau_Yield_HB_Tot ( MainI ) = 0 . d0
759 K_Tot ( MainI ) = 0 . d0
760 n _ T o t ( MainI ) = 0 . d0
761 A l p h a _ T o t ( MainI ) = 0 . d0
762 Delta_Tot_HB ( MainI ) = 0 . d0
763 Delta_Tot_BH ( MainI ) = 0 . d0
764 PV_Tot ( MainI ) = 0 . d0
765 YP_Tot ( MainI ) = 0 . d0
766
767 Else
768 FluidData = ’ Yes ’ ! D e f i n i t i o n of the FluidData case .
769
770 W r i t e ( Message , ’ (A) ’ ) " F l u i d d a t a i s p r e s e n t and c o m p l e t e . "
771 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
772
773 ! HB
774 ! −−−−−−−−−−−−−−−−−−−−−−
775 C a l l H e r s c h e l _ B u l k l e y ( LogGamma , Y, Tau_Yield_HB , K, n , Alpha , D e l t a , Sample_Code , MainI ,
C o n v e r s i o n _ D e g r _ P a , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , GammaY , Tau ,
Tau_Calc_HB , A l p h a _ A l l , D e l t a _ A l l )
776
777 K_Tot ( MainI ) = K ! F i l l i n g the vector containing the r e s u l t s
of a l l the samples .
778 n _ T o t ( MainI ) = n
779 Tau_Yield_HB_Tot ( MainI ) = Tau_Yield_HB
780 A l p h a _ T o t ( MainI ) = Alpha
781 Delta_Tot_HB ( MainI ) = Delta
782
783 W r i t e ( Message , ’ (A, F5 . 3 , A, F5 . 3 , A, F4 . 2 , A, F8 . 3 ) ’ ) "K, n , Alpha and D e l t a : " ,K, " , " , n , " , " ,
Alpha , " and " , D e l t a
784 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
785
786 ! Bingham
787 ! −−−−−−−−−−−−−−−−−−−−−−
788 C a l l Bingham ( MainI , PV , YP , RPM_600 , RPM_300 , C o n v e r s i o n _ D e g r _ l b , C o n v e r s i o n _ l b _ P a ,
Conversion_RPM_PerS , GammaY , Tau_Calc_BH , Tau , D e l t a )
789
790 PV_Tot ( MainI ) = PV ! F i l l i n g the vector c o n t a i n i n g the r e s u l t s of a l l
the samples .
791 YP_Tot ( MainI ) = YP
792 Delta_Tot_BH ( MainI ) = Delta
793
794 W r i t e ( Message , ’ (A, F , A, F5 . 2 , A, F8 . 3 ) ’ ) "PV , YP and D e l t a : " ,PV , " , " ,YP , " and " , D e l t a
795 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
796
146 E. Code of the SampleSource Program

797 ! −−−−−−−−−−−−−−−−−−−−−−
798
799 Write ( * , * )
800 I f ( Delta_Tot_HB ( MainI ) < Delta_Tot_BH ( MainI ) ) Then
801 W r i t e ( Message , ’ (A) ’ ) " F l u i d p a r a m e t e r s d e t e r m i n e d and Herschel Bulkley r e s u l t s in
the best f i t . "
802 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
803 HB_No = HB_No + 1 ! Counter t h a t keeps t r a c k o f t h e amount o f s a m p l e s
where H e r s c h e l − B u l k l e y i s t h e b e s t f i t .
804 Else
805 W r i t e ( Message , ’ (A) ’ ) " F l u i d p a r a m e t e r s d e t e r m i n e d and Bingham r e s u l t s i n t h e b e s t
fit ."
806 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
807 BH_No = BH_No + 1 ! Counter t h a t keeps t r a c k o f t h e amount o f s a m p l e s
where Bingham i s t h e b e s t f i t .
808 End I f
809 End I f
810
811 I f ( RunOption == 2 ) W r i t e ( * , * ) " Check "
812
813 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
814
815 C a l l T i m e I n t e r v a l _ P D ( TimeInt_PD , DateTime_PD , Index_PD )
816 ! P r o D a t a t i m e i n t e r v a l from t h e Index_PD t o t h e s t a r t o f t h e d r i l l i n g .
817 ! The s u b r o u t i n e t a k e s t h e s t o p s i n t o a c c o u n t and t h e l a r g e r i n t e r v a l s due t o m i s s i n g d a t a .
818
819 C a l l T r a n s p o r t L e n g t h _ P D ( PumpVol , Index_PD , A_bh , TranspLen , TranspLenSum , TimeInt_PD , MudFlw , Loss_P
)
820
821 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 . 3 "
822
823 C a l l I n t e r s e c t i o n ( DateTime_PD , Index_PD , DateTime_Sur , I n d e x _ S u r , TranspLenSum ,MD, Index_Sol_PD ,
I n d e x _ S o l _ S u r , S o u r c e L o c _ S u r , SourceLoc_PD , SourceLocAv , DateTimeSample )
824 ! Works and d e l i v e r s t h e i n d i c e s o f t h e PD and S u r d a t a b a s e s t h a t r e s u l t i n Away and
TransLenSum h a v i n g e x a c t o r a p p r o x i m a t e l y t h e same v a l u e .
825
826 S o u r c e L o c A v A l l ( MainI ) = SourceLocAv ! F i l l i n g the vector containing the r e s u l t s
of a l l the samples .
827 P o s i t i o n B i t A l l ( MainI ) = MD( I n d e x _ S u r )
828
829 C a l l S o u r c e L o c a t i o n ( I n d e x _ S o l _ S u r , SourceLocAv , MD, E l e v a t i o n C a l c , Away , R_Calc , S o u r c e D e p t h ,
SourceAway , S o u r c e R i g h t )
830
831 S o u r c e D e p t h T o t ( MainI ) = SourceDepth
832 SourceAwayTot ( MainI ) = SourceAway
833 S o u r c e R i g h t T o t ( MainI ) = SourceRight
834
835 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 . 4 "
836
837 I f ( I n d e x _ S o l _ P D > 0 . and . I n d e x _ S o l _ S u r > 0 ) Then
838 C a l l T r a n s p o r t T i m e s ( DateTime_PD , DateTime_Sur , Index_Sol_PD , I n d e x _ S o l _ S u r , DateTimeSample ,
T i m e I n t 1 , T i m e I n t 2 , TimeIntAv )
839 T i m e I n t A v A l l ( MainI ) = TimeIntAv
840
841 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 6 . 5 "
842
843 C a l l PumpTimes ( MudFlw , TimeInt_PD , Index_Sol_PD , Index_PD , PumpTime )
844 PumpTimesAll ( MainI ) = PumpTime
845
846 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 7 "
847
848 Else
849 W r i t e ( Message , ’ (A) ’ ) "No s o l u t i o n was found , s o b o t h t r a n s p o r t and pump t i m e can ’ t be
calculated . "
850 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
851
852 T i m e I n t A v A l l ( MainI ) = 0 . d0
853 PumpTimesAll ( MainI ) = 0 . d0
854 End I f
855
856 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
147

857
858 S e l e c t Case ( F l u i d D a t a )
859
860 Case ( ’ Yes ’ )
861 W r i t e ( Message , ’ (A) ’ ) " F l u i d d a t a i s f o u n d and c o m p l e t e . "
862 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
863
864 ! Write ( * , ’ ( A, F ) ’) " A_bh " , A_bh
865 ! Write ( * , ’ ( A, F ) ’) " Loss_P " , Loss_P
866 ! Write ( * , ’ ( A, I ) ’) " Index_PD " , Index_PD
867 ! Write ( * , ’ ( A, I ) ’) " Index_Sol_PD " , Index_Sol_PD
868
869 C a l l F l u i d V e l o c i t y ( AverageV , MaxV , Index_PD , Index_Sol_PD , MudFlw , A_bh , Loss_P )
870
871 AverageV_Tot ( MainI ) = AverageV
872 MaxV_Tot ( MainI ) = MaxV
873
874 v = AverageV_Tot ( MainI )
875
876 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D90 = D( MainI , 9 0 ) / 1 0 0 0 ! [m]
877 I f ( L o c a t i o n == ’ T e x e l ’ ) D90 = D( MainI + 3 1 , 9 0 ) / 1 0 0 0 ! The a r r a y D c o n t a i n s a l l
s a m p l e s and t h o s e o f DH a r e on t o p .
878
879 Call D m a x T r a n s p o r t ( MinYg , YP_Tot ( MainI ) , Rho_Inflow , Rho_Grain , g , DmaxTrMinBH , ’BH ’ )
880 Call D m a x T r a n s p o r t ( MinYg , Tau_Yield_HB_Tot ( MainI ) , Rho_Inflow , Rho_Grain , g , DmaxTrMinHB , ’HB ’ )
881 Call D m a x T r a n s p o r t ( MaxYg , YP_Tot ( MainI ) , Rho_Inflow , Rho_Grain , g , DmaxTrMaxBH , ’BH ’ )
882 Call D m a x T r a n s p o r t ( MaxYg , Tau_Yield_HB_Tot ( MainI ) , Rho_Inflow , Rho_Grain , g , DmaxTrMaxHB , ’HB ’ )
883
884 DmaxTrMinBH_Tot ( MainI ) = DmaxTrMinBH
885 DmaxTrMinHB_Tot ( MainI ) = DmaxTrMinHB
886 DmaxTrMaxBH_Tot ( MainI ) = DmaxTrMaxBH
887 DmaxTrMaxHB_Tot ( MainI ) = DmaxTrMaxHB
888
889 C a l l MaxDiameterSusp ( D_max , v , g , D_bh , Rho_Grain , Rho_Bf ( MainI ) , SC ( MainI ) )
890 D_Max_Tot ( MainI ) = D_Max
891
892 JointNo = J o i n t ( Index_Sol_Sur )
893
894 C a l l M u d P r e s s u r e ( L o c a t i o n , DateTimeSample , P_Real , A c t i v i t y , J o i n t N o , Joint_MP , Mud_P )
895
896 Mud_P_Tot ( MainI ) = Mud_P
897
898 I f ( Delta_Tot_HB ( MainI ) < Delta_Tot_BH ( MainI ) ) Then ! Means t h a t t h e H e r s c h e l
B u l k l e y method i s more p r e c i s e t h a n t h e Bingham method .
899 Tau_Y = Alpha * Tau ( 1 )
900 Else
901 Tau_Y = YP_Tot ( MainI )
902 End I f
903
904 C a l l MaxPlugRadius ( Tau_Y ,MD( I n d e x _ S u r ) , Mud_P_Tot ( MainI ) , MaxPlugR )
905 MaxPlugR_Tot ( MainI ) = MaxPlugR
906
907 W r i t e ( * , ’ (A, F ) ’ ) " Mud_P_Tot ( MainI ) : " , Mud_P_Tot ( MainI )
908
909 C a l l MaxPlugRadius2 ( Tau_Y ,MD( I n d e x _ S u r ) , Mud_P_Tot ( MainI ) , MaxPlugR , D_bh , D_ds )
910
911 D15 = D( MainI , 1 5 ) / 1 0 0 0 . d0 ! [m]
912
913 I f ( MudFlw ( Index_PD ) == 0 . d0 ) Then
914 Do i =1 ,301
915 I f ( MudFlw ( Index_PD − i ) > 0 . d0 ) Then
916 Index_PDMF = Index_PD − i
917 exit
918 End I f
919 End Do
920 Else
921 Index_PDMF = Index_PD
922 End I f
923
924 C a l l I n f i l t r a t i o n L o s s B T L ( L o c a t i o n , g , Loss_BH , S o u r c e D e p t h T o t ( MainI ) , YP_Tot ( MainI ) , D15 , D_bh ,
Mud_P_Tot ( MainI ) , P I )
148 E. Code of the SampleSource Program

925 I n f i l t r a t i o n L o s s B T L _ B H _ T o t ( MainI ) = Loss_BH


926
927 I f ( R u n o p t i o n == 2 ) Then
928 W r i t e ( * , ’ (A, F ) ’ ) " Loss_BH : " , Loss_BH
929 W r i t e ( * , ’ (A, F ) ’ ) " S o u r c e D e p t h T o t ( MainI ) : " , S o u r c e D e p t h T o t ( MainI )
930 W r i t e ( * , ’ (A, F ) ’ ) " YP_Tot ( MainI ) : " , YP_Tot ( MainI )
931 W r i t e ( * , ’ (A, F ) ’ ) " D15 : " , D15
932 W r i t e ( * , ’ (A, F ) ’ ) " D_bh : " , D_bh
933 W r i t e ( * , ’ (A, F ) ’ ) " Mud_P_Tot ( MainI ) : " , Mud_P_Tot ( MainI )
934 End I f
935
936 L o s s P e r c e n t a g e _ B H = ( ( Loss_BH * 1 0 0 0 . d0 * 6 0 . d0 ) / ( MudFlw ( Index_PDMF ) ) ) * 1 0 0 . d0
937 I n f i l L o s s P e r c _ B H _ T o t ( MainI ) = LossPercentage_BH
938
939 I f ( R u n o p t i o n == 2 ) Then
940 W r i t e ( * , ’ (A, I ) ’ ) " Index_PD : " , Index_PD
941 W r i t e ( * , ’ (A, I ) ’ ) " Index_PDMF : " , Index_PDMF
942 W r i t e ( * , ’ (A, I ) ’ ) " MudFlw ( Index_PD ) : " , MudFlw ( Index_PD )
943 W r i t e ( * , ’ (A, I ) ’ ) " MudFlw ( Index_PDMF ) : " , MudFlw ( Index_PDMF )
944 End I f
945
946 W r i t e ( * , ’ (A, F ) ’ ) " I n f i l t r a t i o n L o s s B T L _ B H _ T o t ( MainI ) : " , InfiltrationLossBTL_BH_Tot (
MainI )
947 W r i t e ( * , ’ (A, F5 . 2 ) ’ ) " L o s s P e r c e n t a g e BH : " , LossPercentage_BH
948
949 C a l l I n f i l t r a t i o n L o s s B T L ( L o c a t i o n , g , Loss_HB , S o u r c e D e p t h T o t ( MainI ) , Tau_Yield_HB_Tot ( MainI )
, D15 , D_bh , Mud_P_Tot ( MainI ) , P I )
950 I n f i l t r a t i o n L o s s B T L _ H B _ T o t ( MainI ) = Loss_HB
951
952 L o s s P e r c e n t a g e _ H B = ( ( Loss_HB * 1 0 0 0 . d0 * 6 0 . d0 ) / ( MudFlw ( Index_PDMF ) ) ) * 1 0 0 . d0
953 I n f i l L o s s P e r c _ H B _ T o t ( MainI ) = LossPercentage_HB
954
955 W r i t e ( * , ’ (A, F ) ’ ) " I n f i l t r a t i o n L o s s B T L _ H B _ T o t ( MainI ) : " , InfiltrationLossBTL_HB_Tot (
MainI )
956 W r i t e ( * , ’ (A, F5 . 2 ) ’ ) " L o s s P e r c e n t a g e HB : " , LossPercentage_HB
957
958 W r i t e ( O u t p u t L o s s e s , ’ (A, 3 ( A, F7 . 2 ) ) ’ ) Sample_Code , " ; " , Loss_P * 1 0 0 , " ; " , I n f i l L o s s P e r c _ B H _ T o t ( MainI
) , " ; " , I n f i l L o s s P e r c _ H B _ T o t ( MainI )
959
960 c1 = 0 . 1 2 4 d0 ! a v e r a g e b e t w e e n min and max o f l i t e r a t u r e v a l u e s f o r c1
961 Max_d_BH = M a x D i a m e t e r P l a s t i c i t y ( C1 , YP_Tot ( MainI ) , g , Rho_Bf ( MainI ) , Rho_Grain )
962 Max_d_BH_Tot ( MainI ) = Max_d_BH
963
964 v_settle_BH = S e t t l i n g V e l ( g , Rho_Bf ( MainI ) , Rho_Grain , Max_d_BH_Tot ( MainI ) , PV_Tot ( MainI ) ,
YP_Tot ( MainI ) )
965 v _ s e t t l e _ B H _ T o t ( MainI ) = v_settle_BH
966
967 Gamma_Ann1 = GammaAnn1 ( v , D_bh )
968 Gamma_Ann_Tot1 ( MainI ) = Gamma_Ann1
969
970 Gamma_Ann2 = GammaAnn2 ( v , D_bh , D_ds )
971 Gamma_Ann_Tot2 ( MainI ) = Gamma_Ann2
972
973 W r i t e ( * , ’ (A, F , F ) ’ ) "Gamma_Ann , method 1 and 2 : " , Gamma_Ann_Tot1 ( MainI ) , Gamma_Ann_Tot2 (
MainI )
974
975 DeltaWeightBH1 = 0
976 Do i =1 , s i z e (GammaY)
977 DeltaWeightBH1 = DeltaWeightBH1 + ( ( Tau_Calc_BH ( i ) − Tau ( i ) ) * * 2 . d0 ) * ( 1 . d0 / ( (
Gamma_Ann_Tot1 ( MainI ) − GammaY( i ) ) * * 2 . d0 ) )
978 End Do
979
980 DeltaWeightBH2 = 0
981 Do i =1 , s i z e (GammaY)
982 DeltaWeightBH2 = DeltaWeightBH2 + ( ( Tau_Calc_BH ( i ) − Tau ( i ) ) * * 2 . d0 ) * ( 1 . d0 / ( (
Gamma_Ann_Tot2 ( MainI ) − GammaY( i ) ) * * 2 . d0 ) )
983 End Do
984
985 DeltaWeightHB1 = 0
986 Do i =1 , s i z e (GammaY)
987 DeltaWeightHB1 = DeltaWeightHB1 + ( ( Tau_Calc_HB ( i ) − Tau ( i ) ) * * 2 . d0 ) * ( 1 . d0 / ( (
149

Gamma_Ann_Tot1 ( MainI ) − GammaY( i ) ) * * 2 . d0 ) )


988 End Do
989
990 DeltaWeightHB2 = 0
991 Do i =1 , s i z e (GammaY)
992 DeltaWeightHB2 = DeltaWeightHB2 + ( ( Tau_Calc_HB ( i ) − Tau ( i ) ) * * 2 . d0 ) * ( 1 . d0 / ( (
Gamma_Ann_Tot2 ( MainI ) − GammaY( i ) ) * * 2 . d0 ) )
993 End Do
994
995 I f ( DeltaWeightBH1 < DeltaWeightHB1 ) Then
996 DeltaWBH1_No = DeltaWBH1_No + 1
997 W r i t e ( * , ’ (A) ’ ) "Gamma_Ann 1 : Bingham , t h e b e s t f i t t o t h e d a t a . "
998 E l s e I f ( DeltaWeightBH1 > DeltaWeightHB1 ) Then
999 DeltaWHB1_No = DeltaWHB1_No + 1
1000 W r i t e ( * , ’ (A) ’ ) "Gamma_Ann 1 : H e r s c h e l − B u l k l e y , t h e b e s t f i t t o t h e d a t a . "
1001 End I f
1002
1003 I f ( DeltaWeightBH2 < DeltaWeightHB2 ) Then
1004 DeltaWBH2_No = DeltaWBH2_No + 1
1005 W r i t e ( * , ’ (A) ’ ) "Gamma_Ann 2 : Bingham , t h e b e s t f i t t o t h e d a t a . "
1006 E l s e I f ( DeltaWeightBH2 > DeltaWeightHB2 ) Then
1007 DeltaWHB2_No = DeltaWHB2_No + 1
1008 W r i t e ( * , ’ (A) ’ ) "Gamma_Ann 2 : H e r s c h e l − B u l k l e y , t h e b e s t f i t t o t h e d a t a . "
1009 End I f
1010
1011 Re_Gen_BH = ReynoldsGen ( Rho_Bf ( MainI ) , D_bh , v , YP_Tot ( MainI ) , n_BH , PV_Tot ( MainI ) )
1012 ! Rho_bf , D, v , t a u _ y i e l d , n , K, f o r bingham K=0 and n =1 , d e r i v i n g ( M a d l e n e r 2 0 0 9 ) r e s u l t s i n K
i s r e p l a c e d by t h e v i s c o s i t y a t v e r y h i g h s h e a r t h u s PV .
1013 Re_Gen_BH_Tot ( MainI ) = Re_Gen_BH
1014
1015 Re_Gen_HB = ReynoldsGen ( Rho_Bf ( MainI ) , D_bh , v , Tau_Yield_HB_Tot ( MainI ) , n _ T o t ( MainI ) ,
K_Tot ( MainI ) )
1016 ! Rho_bf , D, v , t a u _ y i e l d , n , K
1017 Re_Gen_HB_Tot ( MainI ) = Re_Gen_HB
1018
1019 W r i t e ( * , ’ (A) ’ ) " Check F l u i d d a t a ’ Yes ’ "
1020
1021 Case ( ’No ’ )
1022
1023 AverageV = 0 . d0
1024 MaxV = 0 . d0
1025 AverageV_Tot ( MainI ) = 0 . d0
1026 MaxV_Tot ( MainI ) = 0 . d0
1027 v = AverageV_Tot ( MainI )
1028 D90 = 0 . d0
1029
1030 W r i t e ( Message , ’ (A) ’ ) "No F l u i d d a t a means f l u i d f l o w c a l c u l a t i o n s a r e n o t p o s s i b l e . "
1031 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
1032
1033 DmaxTrMinBH = 0 . d0
1034 DmaxTrMinBH_Tot ( MainI ) = DmaxTrMinBH
1035 DmaxTrMinHB = 0 . d0
1036 DmaxTrMinHB_Tot ( MainI ) = DmaxTrMinHB
1037 DmaxTrMaxBH = 0 . d0
1038 DmaxTrMaxBH_Tot ( MainI ) = DmaxTrMaxBH
1039 DmaxTrMaxHB = 0 . d0
1040 DmaxTrMaxHB_Tot ( MainI ) = DmaxTrMaxHB
1041
1042 D_Max_Tot ( MainI ) = 0 . d0
1043 Mud_P = 0 . d0
1044 Mud_P_Tot ( MainI ) = 0 . d0
1045 MaxPlugR = 0 . d0
1046 MaxPlugR_Tot ( MainI ) = 0 . d0
1047 LossPercentage_BH = 0 . d0
1048 I n f i l L o s s P e r c _ B H _ T o t ( MainI ) = 0 . d0
1049 LossPercentage_HB = 0 . d0
1050 I n f i l L o s s P e r c _ H B _ T o t ( MainI ) = 0 . d0
1051
1052 W r i t e ( O u t p u t L o s s e s , ’ (A, 3 ( A, F7 . 2 ) ) ’ ) Sample_Code , " ; " , Loss_P * 1 0 0 , " ; " , I n f i l L o s s P e r c _ B H _ T o t (
MainI ) , " ; " , I n f i l L o s s P e r c _ H B _ T o t ( MainI )
1053
150 E. Code of the SampleSource Program

1054 Max_d_BH = 0 . d0
1055 Max_d_BH_Tot ( MainI ) = Max_d_BH
1056 v_settle_BH = 0 . d0
1057 v _ s e t t l e _ B H _ T o t ( MainI ) = v_settle_BH
1058 Gamma_Ann1 = 0 . d0
1059 Gamma_Ann_Tot1 ( MainI ) = Gamma_Ann1
1060 Gamma_Ann2 = 0 . d0
1061 Gamma_Ann_Tot2 ( MainI ) = Gamma_Ann2
1062 DeltaWeightBH1 = 0 . d0
1063 DeltaWeightBH2 = 0 . d0
1064 DeltaWeightHB1 = 0 . d0
1065 DeltaWeightHB2 = 0 . d0
1066 Re_Gen_BH = 0 . d0
1067 Re_Gen_BH_Tot ( MainI ) = Re_Gen_BH
1068 Re_Gen_HB = 0 . d0
1069 Re_Gen_HB_Tot ( MainI ) = Re_Gen_HB
1070
1071 W r i t e ( * , ’ (A) ’ ) " Check F l u i d d a t a ’No ’ "
1072
1073 Case D e f a u l t
1074
1075 W r i t e ( * , ’ (A) ’ ) " S o m e t h i n g went wrong i n t h e s e l e c t i o n o f t h e f l u i d d a t a c a s e l o o p . "
1076 Read ( * , * )
1077
1078 End S e l e c t
1079
1080 ! −−−−−−−−−−−−−−−−−−−−−−
1081 ! Write F i l e s
1082 ! −−−−−−−−−−−−−−−−−−−−−−
1083 ! Adds a comma− d e l i m i t e d t i t l e i n t h e f i l e w i t h t h e c o n t e n t and t h e u n i t o f t h e v e c t o r
1084 ! Based on h t t p s : / / s o f t w a r e . i n t e l . com / en − u s / f o r u m s / t o p i c / 3 5 5 4 2 8 .
1085 ! P a r t i a l l y b a s e d on h t t p : / / s t a c k o v e r f l o w . com / q u e s t i o n s / 2 1 1 1 7 2 1 6 / f o r t r a n − f o r m a t e d − o u t p u t −
f o r − f l o a t i n g − p o i n t − numbers
1086
1087 W r i t e ( O u t p u t S a m p l e s , ’ ( 4 (A) , I , 8 ( A, F ) ,A, I 5 . 5 , 1 4 ( A, F ) ) ’ ) Sample_Code , " ; " , DateTimeSample , " ; "
, MainI , " ; " , S o u r c e L o c A v A l l ( MainI ) , " ; " , S a m p l i n g D e p t h T o t ( MainI ) , " ; " , SamplingAwayTot ( MainI )
, " ; " , S a m p l i n g R i g h t T o t ( MainI ) , " ; " , S o u r c e D e p t h T o t ( MainI ) , " ; " , SourceAwayTot ( MainI ) , " ; " ,
S o u r c e R i g h t T o t ( MainI ) , " ; " , P o s i t i o n B i t A l l ( MainI ) , " ; " , PumpTime , " ; " , Tau_Yield_HB_Tot ( MainI )
, " ; " , K_Tot ( MainI ) , " ; " , n _ T o t ( MainI ) , " ; " , A l p h a _ T o t ( MainI ) , " ; " , Delta_Tot_HB ( MainI ) , " ; " ,
PV_Tot ( MainI ) , " ; " , YP_Tot ( MainI ) , " ; " , Delta_Tot_BH ( MainI ) , " ; " , Mud_P_Tot ( MainI ) , " ; " ,
MaxPlugR_Tot ( MainI ) , " ; " , AverageV_Tot ( MainI ) , " ; " , D_Max_Tot ( MainI ) , " ; " , Max_d_BH_Tot ( MainI ) ,
" ; " , v _ s e t t l e _ B H _ T o t ( MainI )
1088
1089 W r i t e ( O u t p u t S a m p l e s L o c , ’ ( 2 (A) , 6 ( F ) ) ’ ) Sample_Code , DateTimeSample ,
SamplingAwayTot ( MainI ) , S a m p l i n g D e p t h T o t ( MainI ) , S a m p l i n g R i g h t T o t ( MainI ) , SourceAwayTot (
MainI ) , S o u r c e D e p t h T o t ( MainI ) , S o u r c e R i g h t T o t ( MainI )
1090
1091 W r i t e ( O u t p u t F l u i d P r o p e r t i e s , ’ ( 3 (A) , 8 ( A, F ) ) ’ ) Sample_Code , " ; " , DateTimeSample , " ; " ,
Tau_Yield_HB_Tot ( MainI ) , " ; " , K_Tot ( MainI ) , " ; " , n _ T o t ( MainI ) , " ; " , A l p h a _ T o t ( MainI ) , " ; " ,
Delta_Tot_HB ( MainI ) , " ; " , PV_Tot ( MainI ) , " ; " , YP_Tot ( MainI ) , " ; " , Delta_Tot_BH ( MainI )
1092
1093 W r i t e ( O u t p u t F l u i d P r o p T e x , ’ ( 2 (A) , 8 ( F ) ) ’ ) Sample_Code , DateTimeSample ,
Tau_Yield_HB_Tot ( MainI ) , K_Tot ( MainI ) , n _ T o t ( MainI ) , A l p h a _ T o t ( MainI ) , Delta_Tot_HB ( MainI ) ,
PV_Tot ( MainI ) , YP_Tot ( MainI ) , Delta_Tot_BH ( MainI )
1094
1095 W r i t e ( O u t p u t T r a n s p o r t P r o p e r t i e s , ’ ( 3 (A) , 1 6 (A, F ) ) ’ ) Sample_Code , " ; " , DateTimeSample , " ; " ,
MaxPlugR_Tot ( MainI ) , " ; " , AverageV_Tot ( MainI ) , " ; " , D_Max_Tot ( MainI ) , " ; " , Gamma_Ann_Tot1 ( MainI
) , " ; " , Gamma_Ann_Tot2 ( MainI ) , " ; " , Re_Gen_BH_Tot ( MainI ) , " ; " , Re_Gen_HB_Tot ( MainI ) , " ; " , D90 , " ; "
, DmaxTrMinBH_Tot ( MainI ) , " ; " , DmaxTrMaxBH_Tot ( MainI ) , " ; " , DmaxTrMinHB_Tot ( MainI ) , " ; " ,
DmaxTrMaxHB_Tot ( MainI ) , " ; " , DeltaWeightBH1 , " ; " , DeltaWeightBH2 , " ; " , DeltaWeightHB1 , " ; " ,
DeltaWeightHB2
1096
1097 W r i t e ( O u t p u t T r a n s p o r t P r o p T e x , ’ ( 2 (A) , 1 6 ( F ) ) ’ ) Sample_Code , DateTimeSample ,
MaxPlugR_Tot ( MainI ) , AverageV_Tot ( MainI ) , D_Max_Tot ( MainI ) , Gamma_Ann_Tot1 ( MainI ) ,
Gamma_Ann_Tot2 ( MainI ) , Re_Gen_BH_Tot ( MainI ) , Re_Gen_HB_Tot ( MainI ) , D90 , DmaxTrMinBH_Tot ( MainI
) , DmaxTrMaxBH_Tot ( MainI ) , DmaxTrMinHB_Tot ( MainI ) , DmaxTrMaxHB_Tot ( MainI ) , DeltaWeightBH1 ,
DeltaWeightBH2 , DeltaWeightHB1 , DeltaWeightHB2
1098
1099 I f ( RunOption == 2 ) W r i t e ( TableHans , ’ ( 3 (A) , 6 ( A, F ) ) ’ ) Sample_Code , " ; " , S i e v e _ C o d e ( MainI ) , " ; "
, SamplingAwayTot ( MainI ) , " ; " , SourceAwayTot ( MainI ) , " ; " ,MD( I n d e x _ S u r ) , " ; " ,MD( I n d e x _ S o l _ S u r ) ,
" ; " , S a m p l i n g D e p t h T o t ( MainI ) , " ; " , S o u r c e D e p t h T o t ( MainI )
151

1100 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 9 "


1101
1102 W r i t e ( * , ’ (A) ’ ) " Check W r i t i n g F i l e s "
1103
1104 ! −−−−−−−−−−−−−−−−−−−−−−
1105 ! C a l l i n g Gnuplot
1106 ! −−−−−−−−−−−−−−−−−−−−−−
1107 ! Enables t he c r e a t i o n of graphs in o r d e r to v i s u a l l y check t he answers without r e q u i r i n g
t h e c r e a t i o n o f two g r a p h s i n s e p a r a t e . c s v f i l e s and m e r g i n g them .
1108 ! −−−−−−−−−−−−−−−−−−−−−−
1109
1110 I f ( I n d e x _ S o l _ P D > 0 . and . I n d e x _ S o l _ S u r > 0 ) Then ! E f f i c i e n c y m e a s u r e i f no s o l u t i o n
i s found , I n d e x _ S o l . . . <=0 t h a n no p l o t s a r e made e i t h e r s i n c e t h e y would c o n t a i n
nonsense .
1111
1112 S e l e c t Case ( F l u i d D a t a )
1113
1114 Case ( ’ Yes ’ )
1115 C a l l f 2 g p S a m p l e M u l t i ( Sample_Code , Index_PD , I n d e x _ S u r , Index_Sol_PD , DateTime_PD ,
TranspLenSum , ’ 2 a ’ , DateTime_Sur ,MD, ’ 2 b ’ , A l p h a _ A l l , D e l t a _ A l l , ’ 2 c ’ ,GammaY , Tau , ’ 3 a ’ ,
Tau_Calc_HB , ’ 3 b ’ , Tau_Calc_BH , ’ 3 c ’ , ’ D a t e Time ’ , ’ L e n g t h [m] ’ , ’ Alpha [ − ] ’ , ’ D e l t a ’ , ’ S h e a r
R a t e [ 1 / s ] ’ , ’ S h e a r S t r e s s [ Pa ] ’ , ’ Sample P a r a m e t e r s ’ , ’ I n t e r s e c t i o n ’ , ’ Alpha v s . D e l t a ’ , ’
M e a s u r e m e n t s v s . C a l c u l a t i o n s ’ , ’ D e v i a t i o n ’ , ’ M e a s u r e m e n t s ’ , ’ H e r s c h e l B u l k l e y ’ , ’ Bingham ’ , ’
Pumped L e n g t h ’ , ’ Measured D i s t a n c e ’ , S c e n a r i o N o )
1116 W r i t e ( Message , ’ (A) ’ ) " F l u i d d a t a i s d e t e r m i n e d s o 2 p l o t s a r e made . "
1117 C a l l W r i t e L o g ( 1 , Message )
1118
1119 Case ( ’No ’ )
1120 C a l l f 2 g p ( Sample_Code , Index_PD , I n d e x _ S u r , Index_Sol_PD , DateTime_PD , TranspLenSum , ’ 2
a ’ , DateTime_Sur ,MD, ’ 2 b ’ , 1 , ’ DateTime ’ , ’ L e n g t h [m] ’ , ’ Pumped L e n g t h ’ , ’ Measured D i s t a n c e ’ ,
ScenarioNo )
1121 W r i t e ( Message , ’ (A) ’ ) " F l u i d d a t a i s n o t d e t e r m i n e d s o o n l y t h e i n t e r s e c t i o n p l o t
c a n be made . "
1122 C a l l W r i t e L o g ( 1 , Message )
1123
1124 Case D e f a u l t
1125 W r i t e ( * , ’ (A) ’ ) " S o m e t h i n g went wrong w i t h t h e ’ F l u i d D a t a ’ c a s e . "
1126 Read ( * , * )
1127 Stop
1128
1129 End S e l e c t
1130 End I f
1131
1132 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 10 "
1133
1134 ! D e a l l o c a t i o n s o t h e a r r a y s c a n be r e a l l o c a t e d f o r n e x t c y c l e s o f t h e m a i n l o o p i n which
t h e c o n t e n t and s i z e c a n be d i f f e r e n t .
1135 ! −−−−−−−−−−−−−−−−−−−−−−
1136 D e a l l o c a t e ( TimeInt_PD , PumpVol , TranspLen , TranspLenSum )
1137
1138 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check 11 "
1139
1140 ! I f ( RunOption == 2 ) C l o s e ( SampleLog )
1141
1142 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1143 ! END MAIN LOOP
1144 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1145 End Do M a i n l o o p
1146 Write ( * , * )
1147 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1148 Write ( * , * )
1149 W r i t e ( * , ’ (A) ’ ) " The Main Loop h a s f i n i s h e d . "
1150 Write ( * , * )
1151 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1152 Write ( * , * )
1153
1154 W r i t e ( Message , ’ (A, I3 , A, I3 , A, I3 , A) ’ ) " The Bingham model was " , BH_No , " t i m e s t h e b e s t f i t and
t h e H e r s c h e l − B u l k l e y model was " , HB_No , " t i m e s t h e b e s t f i t . " , NoFluid_No , " S a m p l e s
c o n t a i n e d i n c o m p l e t e o r no f l u i d d a t a . "
152 E. Code of the SampleSource Program

1155 C a l l W r i t e L o g ( 2 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
1156
1157 W r i t e ( Message , ’ (A, I3 , A, I3 , A, I3 , A) ’ ) " F o r Gamma_Ann1 was Bingham " , DeltaWBH1_No , " t i m e s t h e
b e s t f i t , t h e H e r s c h e l − B u l k l e y model was " , DeltaWHB1_No , " t i m e s t h e b e s t f i t . "
1158 C a l l W r i t e L o g ( 2 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
1159
1160 W r i t e ( Message , ’ (A, I3 , A, I3 , A, I3 , A) ’ ) " F o r Gamma_Ann2 was Bingham " , DeltaWBH2_No , " t i m e s t h e
b e s t f i t , t h e H e r s c h e l − B u l k l e y model was " , DeltaWHB2_No , " t i m e s t h e b e s t f i t . "
1161 C a l l W r i t e L o g ( 2 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
1162
1163 Write ( * , * )
1164 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1165
1166
1167
1168 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1169 ! C a l l i n g Gnuplot
1170 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1171
1172 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check F1 "
1173
1174 ! Times o v e r v i e w
1175 W r i t e ( f i l e n a m e , ’ (A, I 2 . 2 ) ’ ) t r i m ( s h o r t ( L o c a t i o n ) ) / / ’ _ T i m e s _ v s _ L e n g t h _ − _ S c e n a r i o _ ’ , S c e n a r i o N o
1176 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) t r i m ( L o c a t i o n ) / / ’ Times v s . L e n g t h S c e n a r i o ’ , S c e n a r i o N o
1177 C a l l f 2 g p 2 ( DateTime_Samples , T i m e I n t A v A l l , PumpTimesAll , DateTime_Sur , Away , 1 , f i l e n a m e , t r i m ( t i t l e
) , ’ D a t e Time ’ , ’ Time [ s ] ’ , ’ L e n g t h [m] ’ , ’ T r a n s p o r t Time [ s ] ’ , ’ L e n g t h [m] ’ , ’ Pump Time [ s ] ’ )
1178 ! ( x1 , y1a , y1b , x2 , y2 , t y p e o f g r a p h , x − a x i s t i t l e , y − a x i s t i t l e 1 , y − a x i s t i t l e 2 , g r a p h 1 t i t l e
, graph2 t i t l e , graph3 t i t l e )
1179
1180 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check F2 "
1181
1182 ! Length vs . Source l o c a t i o n
1183 W r i t e ( f i l e n a m e , ’ (A, I 2 . 2 ) ’ ) t r i m ( s h o r t ( L o c a t i o n ) ) / / ’ _ L e n g t h _ v s _ S o u r c e _ − _ S c e n a r i o _ ’ , S c e n a r i o N o
1184 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) t r i m ( L o c a t i o n ) / / ’ L e n g t h v s . S o u r c e S c e n a r i o ’ , S c e n a r i o N o
1185 C a l l f 2 g p 3 ( L o c a t i o n , DateTime_Samples , SourceLocAvAll , ’ 3 a ’ , DateTime_Sur ,MD, ’ 2 b ’ , 1 , t r i m ( f i l e n a m e
) , t r i m ( t i t l e ) , ’ D a t e Time ’ , ’ L e n g t h [m] ’ , ’ S o u r c e L o c a t i o n [m] ’ , ’ L e n g t h [m] ’ )
1186 ! ( x1 , y1 , x2 , y2 , t y p e o f g r a p h , t i t l e , x − a x i s t i t l e , y − a x i s t i t l e , g r a p h 1 t i t l e , g r a p h 2 t i t l e
)
1187
1188 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check F3 "
1189
1190 ! Lag Diagram
1191 W r i t e ( f i l e n a m e , ’ (A, I 2 . 2 ) ’ ) t r i m ( s h o r t ( L o c a t i o n ) ) / / ’ _ L a g _ D i a g r a m _ S c e n a r i o _ ’ , S c e n a r i o N o
1192 W r i t e ( t i t l e _ g r a p h , ’ (A, I 2 . 2 ) ’ ) Trim ( s h o r t ( L o c a t i o n ) ) / / ’ Lag Diagram S c e n a r i o ’ , S c e n a r i o N o
1193 C a l l f2gpLagD ( L o c a t i o n , t i t l e _ g r a p h , P o s i t i o n B i t A l l , SourceLocAvAll , 1 , ’ P o s i t i o n Head [m] ’ , ’
S o u r c e L o c a t i o n [m] ’ , t r i m ( f i l e n a m e ) , ’V_T = V_L ’ , ’ 1 k ’ , ’ 1 l ’ , ’ 1m’ , ’ 1 n ’ )
1194 ! ( x d a t a , y d a t a , t y p e o f g r a p h , x− a x i s t i t l e , y− a x i s t i t l e , t i t l e , g r a p h t i t l e )
1195
1196 Open ( 1 0 , f i l e = f i l e f o l d e r _ o u t / / ’ E x t r a F i l e s \ ’ / / t r i m ( f i l e n a m e ) / / ’ . t x t ’ )
1197 Do i =1 , s i z e ( P o s i t i o n B i t A l l )
1198 Write ( 1 0 , ’ ( 2 ( F ) ) ’ ) P o s i t i o n B i t A l l ( i ) , SourceLocAvAll ( i )
1199 End Do
1200 Close (10)
1201
1202 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check F4 "
1203
1204 W r i t e ( * , ’ (A) ’ ) " Check G r a p h s "
1205
1206 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1207 ! End o f p r o g r a m
1208 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1209 ! D e a l l o c a t i o n ( f o r p o s s i b l e r e r u n s w i t h i n t h e program i n t h e f u t u r e )
1210 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1211
1212 D e a l l o c a t e ( DateTime_PD , Bit_DPT , Hol_DPT , Car_POS , Car_SPD , P u l l , Push , Torq_pos , Rot_SPD )
1213 D e a l l o c a t e ( M_Press , MudFlw , Torq_neg , P r e s s _ 1 , P r e s s _ 2 , P r e s s _ 3 , HS_D )
1214
1215 D e a l l o c a t e ( DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w , AzimuthRaw , B t o t , Dip )
1216 D e a l l o c a t e ( E l e v a t i o n C a l c , ElevationMGS , Away , R_Calc , R_MGS)
1217 D e a l l o c a t e ( DateTime_Samples , Sample_ID , Temp , EC , pH , MF, Rho_Bf , SC , RPM_600 , RPM_300 , RPM_200 , RPM_100
153

)
1218 D e a l l o c a t e ( RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s , Gel10min )
1219
1220 D e a l l o c a t e ( A c t i v i t y , Joint_MP , Length_MP )
1221
1222 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) D e a l l o c a t e ( P_Max1 , P_Max2 , P_Calc , P _ R e a l )
1223 I f ( L o c a t i o n == ’ T e x e l ’ ) D e a l l o c a t e ( P_Real , P_Min )
1224
1225 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check Z1 "
1226
1227 D e a l l o c a t e ( PumpTimesAll , T i m e I n t A v A l l )
1228 D e a l l o c a t e ( SourceLocAvAll , P o s i t i o n B i t A l l , Tau_Yield_HB_Tot , K_Tot , n _ T o t )
1229 D e a l l o c a t e ( PV_Tot , YP_Tot , Alpha_Tot , Delta_Tot_HB , Delta_Tot_BH )
1230 D e a l l o c a t e ( Mud_P_Tot , MaxPlugR_Tot )
1231
1232 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check Z2 "
1233
1234 D e a l l o c a t e ( S a m p l i n g D e p t h T o t , SamplingAwayTot , S a m p l i n g R i g h t T o t )
1235 D e a l l o c a t e ( S o u r c e D e p t h T o t , SourceAwayTot , S o u r c e R i g h t T o t )
1236
1237 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check Z3 "
1238
1239 D e a l l o c a t e ( Sieve_Code , D)
1240 ! D e a l l o c a t e ( Sieve_Code_V , D_V)
1241
1242 D e a l l o c a t e ( D_Max_Tot )
1243 D e a l l o c a t e ( AverageV_Tot , MaxV_Tot )
1244 Deallocate ( InfiltrationLossBTL_BH_Tot , InfiltrationLossBTL_HB_Tot )
1245 Deallocate ( InfilLossPerc_BH_Tot , InfilLossPerc_HB_Tot )
1246 D e a l l o c a t e ( Max_D_BH_Tot , v _ s e t t l e _ B H _ T o t )
1247 D e a l l o c a t e ( Gamma_Ann_Tot1 )
1248 D e a l l o c a t e ( Gamma_Ann_Tot2 )
1249 D e a l l o c a t e ( Re_Gen_BH_Tot , Re_Gen_HB_Tot )
1250 D e a l l o c a t e ( DmaxTrMinBH_Tot , DmaxTrMinHB_Tot , DmaxTrMaxBH_Tot , DmaxTrMaxHB_Tot )
1251
1252 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check Z4 "
1253
1254 W r i t e ( * , ’ (A) ’ ) " Check D e a l l o c a t i o n "
1255
1256 ! Closing Files
1257 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1258 Close ( InputDim )
1259 C l o s e ( InputCSV_PD )
1260 C l o s e ( InputCSV_Sur )
1261 C l o s e ( InputMP )
1262 Close ( SampleData )
1263 Close ( OutputLosses )
1264 Close ( OutputSamples )
1265 Close ( OutputSamplesLoc )
1266 Close ( O u t p u t F l u i d P r o p e r t i e s )
1267 Close ( OutputFluidPropTex )
1268 Close ( O u t p u t T r a n s p o r t P r o p e r t i e s )
1269 Close ( OutputTransportPropTex )
1270 Close ( OutputLosses )
1271 Close ( Si ev eRe su lts )
1272 ! Close ( SieveResults_V )
1273
1274 I f ( RunOption == 2 ) C l o s e ( T a b l e H a n s )
1275 I f ( RunOption == 2 ) W r i t e ( * , ’ (A) ’ ) " Check Z5 "
1276
1277 Close ( SampleSourceLog )
1278
1279 W r i t e ( * , ’ (A) ’ ) " Check C l o s i n g F i l e s "
1280
1281 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1282
1283 S e l e c t Case ( P r o g r a m O p t i o n )
1284
1285 Case ( 1 )
1286
1287 Write ( * , * )
154 E. Code of the SampleSource Program

1288 W r i t e ( * , ’ (A) ’ ) "


−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1289 W r i t e ( * , ’ (A) ’ ) " The c h o s e n p a r t o f t h e p r o g r a m i s e x e c u t e d , t o go b a c k t o t h e s t a r t t y p e
’1 ’ or t y p e ’0 ’ t o c l o s e t h e program : "
1290 Read ( * , * ) EndOption
1291
1292 I f ( E n d O p t i o n == 0 ) S t o p
1293 I f ( E n d O p t i o n == 1 ) Go To 100
1294
1295 Case ( 2 )
1296
1297 I f ( S c e n a r i o N o == 9 ) Then
1298 W r i t e ( * , ’ (A) ’ ) " A l l s c e n a r i o s f o r l o c a t i o n " / / t r i m ( L o c a t i o n ) / / " a r e r u n . "
1299 W r i t e ( * , ’ (A) ’ ) " P r e s s ’ 0 ’ t o c l o s e t h e p r o g r a m o r ’ 1 ’ t o c o n t i n u e w i t h t h e o t h e r
location : "
1300 Read ( * , * ) EndOption
1301
1302 S e l e c t Case ( E n d O p t i o n )
1303
1304 Case ( 0 )
1305
1306 Stop
1307
1308 Case ( 1 )
1309
1310 Write ( * , * )
1311 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1312 Write ( * , * )
1313 Go t o 100
1314
1315 Case D e f a u l t
1316
1317 W r i t e ( * , ’ (A) ’ ) " Unknown o p t i o n p r o g r a m i s t e r m i n a t e d . "
1318 Read ( * , * )
1319 Stop
1320
1321 End S e l e c t
1322
1323 End I f
1324 ScenarioNo = ScenarioNo + 1
1325 Go To 500
1326
1327 Case ( 3 )
1328
1329 I f ( S c e n a r i o N o == S c e n a r i o N o 2 ) Then
1330 W r i t e ( * , ’ (A) ’ ) " Both s c e n a r i o s h a v e run , p r o g r a m w i l l c l o s e . "
1331 Read ( * , * )
1332 Stop
1333 Else
1334 ScenarioNo = ScenarioNo2
1335 I f ( S c e n a r i o N o == 0 ) Then
1336 W r i t e ( * , ’ (A) ’ ) " The s c e n a r i o h a s run , t h e p r o g r a m w i l l c l o s e . "
1337 Read ( * , * )
1338 Stop
1339 End I f
1340
1341 Write ( * , * )
1342 W r i t e ( * , ’ (A) ’ ) " The s e c o n d c h o s e n s c e n a r i o w i l l s t a r t now . "
1343 Write ( * , * )
1344 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1345
1346 Go t o 500
1347 End I f
1348
1349 Case ( 4 )
1350
1351 I f ( S c e n a r i o N o == 9 ) Then
1352 FullRunCounter = FullRunCounter + 1
1353 I f ( F u l l R u n C o u n t e r == 1 ) Then
155

1354 W r i t e ( * , ’ (A) ’ ) " A l l s c e n a r i o s f o r l o c a t i o n " / / t r i m ( L o c a t i o n ) / / " a r e r u n . "


1355 W r i t e ( * , ’ (A) ’ ) " The s e c o n d l o c a t i o n w i l l now be done "
1356 I f ( L o c a t i o n == ’ T e x e l ’ ) Then
1357 L o c a t i o n = ’ Den H e l d e r ’
1358 ScenarioNo = 1
1359 Write ( * , * )
1360 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1361 Write ( * , * )
1362 Go t o 500
1363 E l s e I f ( L o c a t i o n == ’ Den H e l d e r ’ ) Then
1364 Location = ’ Texel ’
1365 ScenarioNo = 1
1366 Write ( * , * )
1367 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1368 Write ( * , * )
1369 Go t o 500
1370 End I f
1371 E l s e I f ( F u l l R u n C o u n t e r == 2 ) Then
1372 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1373 Write ( * , * )
1374 W r i t e ( * , ’ (A) ’ ) " A l l s c e n a r i o s f o r b o t h l o c a t i o n s h a v e run , t h e p r o g r a m w i l l now
close . "
1375 Write ( * , * )
1376 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1377 Read ( * , * )
1378 Stop
1379 End I f
1380 End I f
1381 ScenarioNo = ScenarioNo + 1
1382 Go To 500
1383
1384 End S e l e c t
1385
1386 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1387
1388 End Program S o u r c e S a m p l e

Code/SampleSourceV1a.f90

1 Module S o u r c e M o d u l e
2
3 I m p l i c i t None
4
5 Contains
6
7 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
8 ! FUNCTIONS
9 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10
11 I n t e g e r Function LineCount ( F i l e )
12 ! C a l c u l a t e s t h e amount o f l i n e s i n a f i l e
13 ! Based on h t t p : / / web . u t a h . edu / t h o r n e / c o m p u t i n g / H a n d y _ F o r t r a n _ T r i c k s . pdf , b o t t o m l a s t p a g e
14 ! See h t t p : / / s t a c k o v e r f l o w . com / q u e s t i o n s / 1 9 7 1 3 2 0 7 / u s i n g −do − l o o p − i n −a − f o r t r a n 9 0 − program − t o −
r e a d − d i f f e r e n t − number − of − l i n e s − f o r −n − f r a f o r how t o c h a n g e t o column c o u n t .
15 I m p l i c i t None
16
17 Integer :: File , nlines
18 Integer :: io
19
20 nlines = 0 ! Number o f l i n e s n e e d s a s t a r t v a l u e
21
22 Do
23 Read ( F i l e , * , IOSTAT= i o )
24 I f ( i o > 0 ) Then
25 W r i t e ( * , * ) " Check i n p u t . S o m e t h i n g i s wrong . . . "
26 Exit
156 E. Code of the SampleSource Program

27 E l s e I f ( i o < 0 ) Then ! I o s t a t i s n e g a t i v e f o r end o f f i l e .


28 ! WRITE ( * , * ) " End o f f i l e i s r e a c h e d . " ! No l o n g e r n e c e s s a r y o n c e i t works .
29 Exit
30 Else
31 n l i n e s = n l i n e s +1
32 End I f
33 End Do
34
35 Rewind ( F i l e ) ! Reading of t h e d a t a s t a r t s a t t h e top of t h e f i l e again .
36
37 Linecount = nlines
38
39 End F u n c t i o n
40
41 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
42
43 I n t e g e r F u n c t i o n ColumnCount ( F i l e , S e p a r a t o r )
44 ! C o u n t s t h e number o f c o l u m n s i n a f i l e by c o u n t i n g t h e s e p a r a t o r s .
45 ! Assumed i s t h a t t h e f i l e h a s t h e same number o f c o l u m n s f o r e v e r y l i n e and t h a t t h e l i n e s
a r e s e p a r a t e d by a symbol which i s n o t e q u a l t o t h e d e c i m a l o r t h o u s a n d s i g n and n o t
e q u a l t o t h e symbol f o r empty s p a c e s i f t h o s a a r e p r e s e n t .
46 ! Based on h t t p : / / r o s e t t a c o d e . o r g / w i k i / C o u n t _ o c c u r r e n c e s _ o f _ a _ s u b s t r i n g # F o r t r a n
47 I m p l i c i t None
48
49 Integer :: File
50 Integer :: nSeparators
51 Character (*) :: Separator
52 Character (2048) :: Line
53 Integer :: Pos , posmin
54
55 Read ( F i l e , ’ (A) ’ ) L i n e
56
57 nSeparators = 0
58 Posmin = 1
59
60 Do ! I n f i n i t e loop , loop r u n s t i l l t h e command i s r e a c h e d t h a t c l o s e s i t .
61 Pos = I n d e x ( L i n e ( posmin : ) , S e p a r a t o r )
62
63 I f ( Pos == 0 ) Then ! EOF i s r e a c h e d , i n d e x r e t u r n s 0 i f s u b s t r i n g i s n o t f o u n d .
64 ColumnCount = nSeparators + 1 ! nColumns i s a c t u a l l y t h e number o f s e p a r a t o r s .
65 Rewind ( F i l e ) ! Reading of t h e d a t a s t a r t s a t t h e top of t h e f i l e again .
66 Return ! C l o s e s t h e do − l o o p and t h u s t h e f u n c t i o n .
67 End I f
68
69 nSeparators = nSeparators + 1
70 posmin = posmin + p o s + l e n ( S e p a r a t o r )
71 End Do
72
73 End F u n c t i o n
74
75 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
76
77 C h a r a c t e r ( 1 0 0 ) F u n c t i o n S h o r t ( Long )
78 ! E n a b l e s a s h o r t c u t t o a b b r e v i a t e d words .
79 I m p l i c i t None
80
81 Character (*) :: Long
82
83 S e l e c t Case ( Long )
84
85 Case ( ’ Den H e l d e r ’ )
86
87 Short = ’DH’
88
89 Case ( ’ T e x e l ’ )
90
91 Short = ’T ’
92
93 Case D e f a u l t
94
95 W r i t e ( * , ’ (A) ’ ) " T h e r e i s no programmed s h o r t f o r t h i s word . "
157

96
97 End S e l e c t
98
99 End F u n c t i o n
100
101 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
102
103 R e a l F u n c t i o n ReynoldsGen ( Rho_bf , D, v , t a u _ y i e l d , n , K)
104 ! G e n e r a l i z e d R e y n o l d s Number a p p l i c a b l e t o HB − e x t e n d e d , HB, PL , BH and N e w t o n i a n f l u i d s ,
Madlener2009 .
105 I m p l i c i t None
106
107 Real :: Rho_bf , D, v , t a u _ y i e l d , n , K, m
108
109 m = ( n * K * ( 8 . d0 * v / D) * * n ) / ( t a u _ y i e l d + K * ( 8 . d0 * v / D) * * n )
110
111 ReynoldsGen = ( Rho_bf * ( v * * ( 2 . d0 − n ) ) * (D* * n ) ) / ( ( t a u _ y i e l d / 8 . d0 ) * ( ( D / v ) * * n ) + K*
( ( ( 3 . d0 *m + 1 . d0 ) / ( 4 . d0 *m) ) * * n ) * ( 8 . d0 * * ( n − 1) ) )
112
113 End F u n c t i o n
114
115 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
116 R e a l F u n c t i o n Hedstrom ( Rho_bf , D, Tau_Y , V i s c o s i t y )
117 ! The Hedstrom Number
118 I m p l i c i t None
119
120 Real :: Rho_bf , D, Tau_Y , V i s c o s i t y
121
122 Hedstrom = ( Rho_bf * Tau_Y * D * D) / ( V i s c o s i t y * V i s c o s i t y )
123
124 End F u n c t i o n
125
126 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
127
128 R e a l F u n c t i o n M a x D i a m e t e r P l a s t i c i t y ( C1 , Tau_Y , g , Rho_bf , Rho_Grain )
129 ! Based on p l a s t i c i t y t h e o r y , 0 . 0 4 8 <= c1 <= 0 . 2
130 I m p l i c i t None
131
132 Real :: C1 , Rho_bf , Rho_Grain , Tau_Y , g
133
134 MaxDiameterPlasticity = ( c1 * Tau_Y ) / ( g * ( Rho_Grain − Rho_bf ) )
135
136 End F u n c t i o n
137
138 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
139
140 R e a l F u n c t i o n S e t t l i n g V e l ( g , Rho_bf , R h o _ g r a i n , d , v i s c o s i t y , Tau_y )
141 ! Based on Wan 1985
142 I m p l i c i t None
143
144 Real :: g , Rho_bf , R h o _ g r a i n , d , v i s c o s i t y , Tau_y
145
146 SettlingVel = ( ( ( R h o _ g r a i n − Rho_bf ) * g * d * d ) / ( 1 8 * v i s c o s i t y ) ) * ( ( 7 * d * Tau_y ) /
(24 * v i s c o s i t y ) )
147
148 End F u n c t i o n
149
150 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
151
152 R e a l F u n c t i o n GammaAnn1 ( v , D_bh )
153 ! Based on Denekamp 2000
154 I m p l i c i t None
155
156 Real :: v , D_bh
157 Real :: R_fac
158
159 R_fac = 1 . 5 d0 ! V a l u e f o u n d i n Denekamp 2000
160
161 GammaAnn1 = R _ f a c * ( ( 8 * v ) / D_bh )
162
163 End F u n c t i o n
158 E. Code of the SampleSource Program

164
165 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
166
167 R e a l F u n c t i o n GammaAnn2 ( v , D_bh , D_ds )
168 ! Based on Mendes 2005
169 I m p l i c i t None
170
171 Real :: v , D_bh , D_ds , Ro , Ri
172
173 Ro = D_bh / 2 . d0
174 Ri = D_ds / 2 . d0
175
176 GammaAnn2 = v / ( Ro − Ri )
177
178 End F u n c t i o n
179
180 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
181 ! SUBROUTINES
182 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
183 ! Common , n o t p r o g r a m s p e c i f i c
184 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
185
186 S u b r o u t i n e W r i t e L o g ( W r i t e O p t i o n , Message , L o g f i l e 1 , L o g f i l e 2 , L o g f i l e 3 )
187 ! D e p e n d i n g on t h e w r i t e o p t i o n i t w r i t e s m e s s a g e s t o t h e s c r e e n ( 1 ) , s c r e e n and up t o t h r e e
l o g f i l e s ( 2 ) o r j u s t t o up t o t h r e e l o g f i l e s ( 3 ) .
188 I m p l i c i t None
189
190 Integer :: WriteOption
191 Character (5) :: WFormat
192 Character (*) :: Message
193 Integer , optional :: Logfile1 , Logfile2 , Logfile3
194
195 WFormat = ’ (A) ’
196
197 S e l e c t Case ( W r i t e O p t i o n )
198
199 Case ( 1 )
200 W r i t e ( * , WFormat ) t r i m ( Message )
201
202 Case ( 2 )
203 W r i t e ( * , WFormat ) t r i m ( Message )
204
205 I f ( p r e s e n t ( L o g f i l e 1 ) ) Then
206 W r i t e ( L o g f i l e 1 , WFormat ) t r i m ( Message )
207 Write ( Logfile1 , * )
208 End I f
209
210 I f ( p r e s e n t ( L o g f i l e 2 ) ) Then
211 W r i t e ( L o g f i l e 2 , WFormat ) t r i m ( Message )
212 Write ( Logfile2 , * )
213 End I f
214
215 I f ( p r e s e n t ( L o g f i l e 3 ) ) Then
216 W r i t e ( L o g f i l e 3 , WFormat ) t r i m ( Message )
217 Write ( Logfile3 , * )
218 End I f
219
220 Case ( 3 )
221 I f ( p r e s e n t ( L o g f i l e 1 ) ) Then
222 W r i t e ( L o g f i l e 1 , WFormat ) t r i m ( Message )
223 Write ( Logfile1 , * )
224 End I f
225
226 I f ( p r e s e n t ( L o g f i l e 2 ) ) Then
227 W r i t e ( L o g f i l e 2 , WFormat ) t r i m ( Message )
228 Write ( Logfile2 , * )
229 End I f
230
231 I f ( p r e s e n t ( L o g f i l e 3 ) ) Then
232 W r i t e ( L o g f i l e 3 , WFormat ) t r i m ( Message )
233 Write ( Logfile3 , * )
159

234 End I f
235
236 Case D e f a u l t
237 W r i t e ( * , ’ (A) ’ ) " The W r i t e o p t i o n i s unknown . "
238
239 End S e l e c t
240
241 End S u b r o u t i n e
242
243 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
244 ! Reading f i l e s
245 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
246
247 S u b r o u t i n e ReadingFileCSV_PD ( F i l e , DateTime_PD , Bit_DPT , Hol_DPT , Car_POS , Car_SPD , P u l l , Push ,
Torq_pos , Rot_SPD , M_Press , MudFlw , Torq_neg , P r e s s _ 1 , P r e s s _ 2 , P r e s s _ 3 , HS_D , N l i n e s _ P D )
248 ! C o n t a i n i n g h e a d e r , 1 s t column i s d a t e and t i m e ( dd −mm− yyyy hh :mm: s s f o r m a t ) , j u s t r e a l
numbers t h e o t h e r c o l u m n s . Columns s e p a r a t e d by " , " .
249 I m p l i c i t None
250
251 Integer :: File
252 Character (100) :: Header
253 Character (19) , allocatable : : DateTime_PD ( : ) , Time ( : )
254 Integer , allocatable : : Bit_DPT ( : ) , Hol_DPT ( : ) , Car_POS ( : ) , Car_SPD ( : ) , P u l l ( : ) , Push ( : ) ,
Torq_pos ( : )
255 Integer , allocatable : : Rot_SPD ( : ) , M_Press ( : ) , MudFlw ( : ) , T o r q _ n e g ( : ) , P r e s s _ 1 ( : ) ,
P r e s s _ 2 ( : ) , P r e s s _ 3 ( : ) ,HS_D ( : )
256 Integer :: n l i n e s , i , io , n l i n e s _ d a t a , Nlines_PD
257 Character (1000) :: Message
258 Integer :: S a m p l e S o u r c e L o g =25
259
260 n l i n e s = LINECOUNT ( F i l e )
261
262 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
263
264 A l l o c a t e ( DateTime_PD ( n l i n e s _ d a t a ) )
265 A l l o c a t e ( Time ( n l i n e s _ d a t a ) )
266 A l l o c a t e ( Bit_DPT ( n l i n e s _ d a t a ) )
267 A l l o c a t e ( Hol_DPT ( n l i n e s _ d a t a ) )
268 A l l o c a t e ( Car_POS ( n l i n e s _ d a t a ) )
269 A l l o c a t e ( Car_SPD ( n l i n e s _ d a t a ) )
270 Allocate ( Pull ( nlines_data ) )
271 A l l o c a t e ( Push ( n l i n e s _ d a t a ) )
272 A l l o c a t e ( Torq_pos ( n l i n e s _ d a t a ) )
273 A l l o c a t e ( Rot_SPD ( n l i n e s _ d a t a ) )
274 A l l o c a t e ( M_Press ( n l i n e s _ d a t a ) )
275 A l l o c a t e ( MudFlw ( n l i n e s _ d a t a ) )
276 A l l o c a t e ( Torq_neg ( n l i n e s _ d a t a ) )
277 Allocate ( Press_1 ( nlines_data ) )
278 Allocate ( Press_2 ( nlines_data ) )
279 Allocate ( Press_3 ( nlines_data ) )
280 A l l o c a t e ( HS_D ( n l i n e s _ d a t a ) )
281
282 Read ( f i l e , ’ ( A100 ) ’ ) Header
283
284 Do i =1 , n l i n e s _ d a t a
285 Read ( f i l e , * , IOSTAT= i o ) DateTime_PD ( i ) , Time ( i ) , Bit_DPT ( i ) , Hol_DPT ( i ) , Car_POS ( i ) , Car_SPD (
i ) , P u l l ( i ) , Push ( i ) , T o r q _ p o s ( i ) , Rot_SPD ( i ) , M_Press ( i ) , MudFlw ( i ) , T o r q _ n e g ( i ) , P r e s s _ 1 ( i ) ,
P r e s s _ 2 ( i ) , P r e s s _ 3 ( i ) ,HS_D ( i )
286 DateTime_PD ( i ) = t r i m ( a d j u s t l ( DateTime_PD ( i ) ) ) / / ’ ’ / / t r i m ( a d j u s t l ( Time ( i ) ) ) !
Space i s counted as s e p e r a t o r as w e l l . . .
287
288 I f ( i o > 0 ) Then
289 W r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
290 W r i t e ( * , * ) " Check f i l e f o r h e a d e r s , P r o d a t a p u t s one e v e r y t i m e t h e r i g ( r e ) s t a r t s . "
291 Exit
292 E l s e i f ( i o < 0 ) Then
293 W r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . "
294 Exit
295 End I f
296 End Do
297
160 E. Code of the SampleSource Program

298 W r i t e ( Message , ’ (A, I8 , A) ’ ) " The P r o D a t a f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g d a t a


a r e found . "
299 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
300
301 Nlines_PD = n l i n e s _ d a t a
302
303 End S u b r o u t i n e
304
305 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
306
307 S u b r o u t i n e R e a d i n g F i l e C S V _ S u r ( F i l e , N l i n e s _ s u r , DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w ,
AzimuthRaw , B t o t , Dip , E l e v a t i o n C a l c , ElevationMGS , Away , R_Calc , R_MGS)
308 ! C o n t a i n i n g h e a d e r , 1 s t column d a t e ( dd −mm− yy ) , 2 nd column t i m e ( hh :mm) , j u s t r e a l numbers
t h e o t h e r columns , b e s i d e s number 11 which c o n t a i n s i n t e g e r s . Columns s e p a r a t e d by " , " .
309 I m p l i c i t None
310
311 Integer :: File
312 Character (130) :: Header
313 Integer , Allocatable :: Date_I ( : )
314 Real , Allocatable :: Time_R ( : )
315 Integer , Allocatable :: J o i nt ( : ) , Btot ( : )
316 Real , Allocatable :: CL ( : ) , I n c l i n a t i o n R a w ( : ) , AzimuthRaw ( : )
317 Real , Allocatable :: Dip ( : ) , E l e v a t i o n C a l c ( : ) , ElevationMGS ( : ) , R_Calc ( : )
318 Real ( 8 ) , Allocatable :: Away ( : ) , MD( : )
319 Real , Allocatable :: R_MGS ( : )
320 Integer :: n l i n e s , i , io , n l i n e s _ d a t a , N l i n e s _ s u r
321 Character (19) , Allocatable :: DateTime_Sur ( : )
322 Character (1000) :: Message
323 Integer :: S a m p l e S o u r c e L o g =25
324
325 n l i n e s = LINECOUNT ( F i l e )
326
327 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
328
329 Allocate ( Joint ( nlines_data ) )
330 Allocate ( Btot ( nlines_data ) )
331 A l l o c a t e ( CL ( n l i n e s _ d a t a ) )
332 A l l o c a t e (MD( n l i n e s _ d a t a ) )
333 A l l o c a t e ( InclinationRAW ( n l i n e s _ d a t a ) )
334 A l l o c a t e ( AzimuthRaw ( n l i n e s _ d a t a ) )
335 A l l o c a t e ( Dip ( n l i n e s _ d a t a ) )
336 Allocate ( ElevationCalc ( nlines_data ) )
337 A l l o c a t e ( ElevationMGS ( n l i n e s _ d a t a ) )
338 A l l o c a t e ( Away ( n l i n e s _ d a t a ) )
339 A l l o c a t e ( R_Calc ( n l i n e s _ d a t a ) )
340 A l l o c a t e (R_MGS( n l i n e s _ d a t a ) )
341 Allocate ( Date_I ( n l i n e s _ d a t a ) ) ! Only u s e d i n t h i s s u b r o u t i n e s o d e a l l o c a t e d a t t h e end .
342 A l l o c a t e ( Time_R ( n l i n e s _ d a t a ) )
343
344 Read ( f i l e , ’ ( A100 ) ’ ) Header
345
346 Do i =1 , n l i n e s _ d a t a ! −1 ! The " − 1" a c c o u n t s f o r t h e l i n e r e a d two l i n e s a b o v e t h i s
sentence .
347 Read ( f i l e , ’ ( I5 , 1 x , F17 . 1 5 , 1 x , I , 9 ( F ) , F4 . 3 , 2 ( F ) ) ’ , IOSTAT= i o ) D a t e _ I ( i ) , Time_R ( i ) , J o i n t ( i ) ,CL
( i ) ,MD( i ) , I n c l i n a t i o n R a w ( i ) , AzimuthRaw ( i ) , B t o t ( i ) , Dip ( i ) , E l e v a t i o n C a l c ( i ) , ElevationMGS ( i )
, Away ( i ) , R_Calc ( i ) ,R_MGS( i )
348
349 I f ( i o > 0 ) Then
350 W r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
351 Exit
352 E l s e i f ( i o < 0 ) Then
353 W r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . "
354 Exit
355 End I f
356 End Do
357
358 Nlines_sur = nlines_data
359
360 C a l l DateTimeFromSur ( DateTime_Sur , D a t e _ I , Time_R , N l i n e s _ s u r )
361
362 W r i t e ( Message , ’ (A, I9 , A) ’ ) " The S u r v e y f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g d a t a
161

a re found . "
363 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
364
365 D e a l l o c a t e ( D a t e _ I , Time_R )
366
367 End S u b r o u t i n e
368
369 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
370
371 S u b r o u t i n e R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , F i l e , No_Samples , DateTime_Samples , Sample_ID , Temp , EC ,
pH , MF, Rho , SC , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s , Gel10min )
372 ! C o n t a i n i n g h e a d e r , 1 s t column d a t e ( dd −mm− yy ) , 2 nd column t i m e ( hh :mm) , j u s t r e a l numbers
t h e o t h e r columns , b e s i d e s number 11 which c o n t a i n s i n t e g e r s . Columns s e p a r a t e d by " , " .
373 I m p l i c i t None
374
375 Integer :: File
376 Character (130) :: Header
377 Integer , Allocatable :: Date_I ( : )
378 Real , Allocatable : : Time_R ( : )
379 Integer :: n l i n e s , i , i o , n l i n e s _ d a t a , No_Samples
380 Character (19) , Allocatable :: DateTime_Samples ( : )
381 Character ( len =:) , Allocatable :: Sample_ID ( : )
382 Real , Allocatable : : Temp ( : ) ,EC ( : ) , pH ( : ) ,MF ( : ) , Rho ( : ) , SC ( : )
383 Integer , Allocatable : : RPM_600 ( : ) , RPM_300 ( : ) , RPM_200 ( : ) , RPM_100 ( : ) , RPM_60 ( : ) ,
RPM_30 ( : ) ,RPM_6 ( : ) ,RPM_3 ( : ) , G e l 1 0 s ( : ) , Gel10min ( : )
384 Character (10) :: Location
385 Character (1000) :: Message
386
387 n l i n e s = LINECOUNT ( F i l e )
388
389 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
390
391 Allocate ( Date_I ( n l i n e s _ d a t a ) )
392 A l l o c a t e ( Time_R ( n l i n e s _ d a t a ) )
393
394 S e l e c t Case ( L o c a t i o n )
395 Case ( ’ Den H e l d e r ’ )
396 Allocate ( character (14) : : Sample_ID ( n l i n e s _ d a t a ) )
397 Case ( ’ T e x e l ’ )
398 Allocate ( character (11) : : Sample_ID ( n l i n e s _ d a t a ) )
399 Case D e f a u l t
400 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n i s unknown , p r o g r a m i s t e r m i n a t e d . "
401 Pause
402 Stop
403 End S e l e c t
404
405 A l l o c a t e ( Temp ( n l i n e s _ d a t a ) )
406 A l l o c a t e ( EC ( n l i n e s _ d a t a ) )
407 A l l o c a t e ( pH ( n l i n e s _ d a t a ) )
408 A l l o c a t e (MF( n l i n e s _ d a t a ) )
409 A l l o c a t e ( Rho ( n l i n e s _ d a t a ) )
410 A l l o c a t e ( SC ( n l i n e s _ d a t a ) )
411 A l l o c a t e ( RPM_600 ( n l i n e s _ d a t a ) )
412 A l l o c a t e ( RPM_300 ( n l i n e s _ d a t a ) )
413 A l l o c a t e ( RPM_200 ( n l i n e s _ d a t a ) )
414 A l l o c a t e ( RPM_100 ( n l i n e s _ d a t a ) )
415 A l l o c a t e ( RPM_60 ( n l i n e s _ d a t a ) )
416 A l l o c a t e ( RPM_30 ( n l i n e s _ d a t a ) )
417 A l l o c a t e ( RPM_6 ( n l i n e s _ d a t a ) )
418 A l l o c a t e ( RPM_3 ( n l i n e s _ d a t a ) )
419 A l l o c a t e ( Gel10s ( n l i n e s _ d a t a ) )
420 A l l o c a t e ( Gel10min ( n l i n e s _ d a t a ) )
421
422 Read ( f i l e , ’ ( A100 ) ’ ) Header
423
424 Do i =1 , n l i n e s _ d a t a
425 Read ( f i l e , ’ ( I5 , 1 x , F17 . 1 5 , 1 x , A, 1 x , 3 ( F5 . 2 , 1 x ) , F6 . 2 , 1 x , 2 ( F5 . 2 , 1 x ) , 1 0 ( I ) ) ’ , IOSTAT= i o ) D a t e _ I (
i ) , Time_R ( i ) , Sample_ID ( i ) , Temp ( i ) ,EC ( i ) , pH ( i ) ,MF( i ) , Rho ( i ) , SC ( i ) , RPM_600 ( i ) , RPM_300 ( i ) ,
RPM_200 ( i ) , RPM_100 ( i ) , RPM_60 ( i ) , RPM_30 ( i ) ,RPM_6 ( i ) ,RPM_3 ( i ) , G e l 1 0 s ( i ) , Gel10min ( i )
426
427 I f ( i o > 0 ) Then
162 E. Code of the SampleSource Program

428 W r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "


429 Exit
430 E l s e i f ( i o < 0 ) Then
431 W r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . "
432 Exit
433 End I f
434 End Do
435
436 No_Samples = n l i n e s _ d a t a
437
438 C a l l DateTimeFromSur ( DateTime_Samples , D a t e _ I , Time_R , No_Samples )
439
440 W r i t e ( Message , ’ (A, I9 , A) ’ ) " The Sample f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g d a t a
a r e found . "
441 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
442
443 D e a l l o c a t e ( D a t e _ I , Time_R )
444
445 End S u b r o u t i n e
446
447 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
448
449 S u b r o u t i n e R e a d i n g F i l e M P ( F i l e , L o c a t i o n , NLines_MP , A c t i v i t y , Joint_MP , Length_MP , V1 , V2 , V3 , V4 )
450 ! Reads t h e f i l e c o n t a i n i n g t h e mud p r e s s u r e s .
451 I m p l i c i t None
452
453 Integer :: File
454 Character (3) , Allocatable :: Activity (:)
455 Integer , Allocatable :: J o i n t _ M P ( : ) , P_Max1 ( : ) , P_Max2 ( : ) , P _ C a l c ( : ) , P _ R e a l ( : ) ,
P_Max ( : ) , P_Min ( : )
456 Real , Allocatable :: Length_MP ( : )
457 Integer :: n l i n e s , i , i o , n l i n e s _ d a t a , Nlines_MP
458 Character (1000) :: Message
459 Character (10) :: Location
460 Integer , Allocatable : : V1 ( : ) , V2 ( : )
461 Integer , Optional , Allocatable : : V3 ( : ) , V4 ( : )
462
463 n l i n e s = LINECOUNT ( F i l e )
464
465 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
466
467 Allocate ( Activity ( nlines_data ) )
468 A l l o c a t e ( Joint_MP ( n l i n e s _ d a t a ) )
469 A l l o c a t e ( Length_MP ( n l i n e s _ d a t a ) )
470 A l l o c a t e ( V1 ( n l i n e s _ d a t a ) )
471 A l l o c a t e ( V2 ( n l i n e s _ d a t a ) )
472
473 I f ( P r e s e n t ( V3 ) ) A l l o c a t e ( V3 ( n l i n e s _ d a t a ) )
474 I f ( P r e s e n t ( V4 ) ) A l l o c a t e ( V4 ( n l i n e s _ d a t a ) )
475
476 Read ( f i l e , * ) ! Reads and s k i p s t h e f i r s t l i n e of the f i l e
477
478 Do i =1 , n l i n e s _ d a t a
479 I f ( t r i m ( L o c a t i o n ) == ’ Den H e l d e r ’ ) Read ( f i l e , ’ ( A3 , 1 x , I 3 . 3 , 1 x , F6 . 1 , 4 ( 1 x , I 4 . 4 ) ) ’ , IOSTAT= i o
) A c t i v i t y ( i ) , J o i n t _ M P ( i ) , Length_MP ( i ) , V2 ( i ) , V3 ( i ) , V4 ( i ) , V1 ( i )
480 I f ( t r i m ( L o c a t i o n ) == ’ T e x e l ’ ) Read ( f i l e , ’ ( A3 , 1 x , I 3 . 3 , 1 x , F6 . 1 , 2 ( 1 x , I 4 . 4 ) ) ’ , IOSTAT= i o )
A c t i v i t y ( i ) , J o i n t _ M P ( i ) , Length_MP ( i ) , V1 ( i ) , V2 ( i )
481
482 I f ( i o > 0 ) Then
483 W r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
484 Exit
485 E l s e I f ( i o < 0 ) Then
486 W r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . "
487 Exit
488 End I f
489 End Do
490
491 W r i t e ( Message , ’ (A, I4 , A) ’ ) " The Mud P r e s s u r e f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g
d a t a a re found . "
492 C a l l W r i t e L o g ( 1 , t r i m ( Message ) )
493
163

494 Nlines_MP = n l i n e s _ d a t a
495
496 End S u b r o u t i n e
497
498 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
499
500 S u b r o u t i n e R e a d i n g F i l e S i e v e ( F i l e , Sample_Code , D)
501 ! Reads t h e s i e v e f i l e , c a n be g e n e r a l i z e d t o be a p p l i c a b l e t o f i l e s w i t h v a r i a b l e p a r a m e t e r
lengths .
502 I m p l i c i t None
503
504 Integer :: File
505 Integer :: n l i n e s , n l i n e s _ d a t a , i , io , j
506 Character (31) , Allocatable :: GefFileName ( : )
507 Character (7) , Allocatable :: Boring_Code ( : )
508 Character (3) , Allocatable : : NEN5104_Code ( : )
509 Character (7) , Allocatable : : Sample_No ( : )
510 Character (14) , Allocatable : : Sample_Code ( : )
511 Character (17) , Allocatable :: Depth ( : )
512 Character (1) :: lineTemp
513 Character (2048) :: Line
514 Integer : : Posmin , Posmax , Pos
515 Character (40) , Allocatable : : Var ( : )
516 Character :: Separator
517 Integer : : nColumns
518 Character (2) : : Number
519 Character (7) : : Code
520 Real , Allocatable : : D( : , : )
521 Integer : : count
522
523 n l i n e s = LineCount ( F i l e )
524 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
525
526 A l l o c a t e (D( n l i n e s _ d a t a , 9 9 ) ) ! (y , x)
527
528 Separator = " , "
529 nColumns = ColumnCount ( F i l e , S e p a r a t o r )
530
531 W r i t e ( * , ’ (A, I10 , A) ’ ) ’ The S i e v e f i l e i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s c o n t a i n i n g d a t a a r e
found . ’
532
533 A l l o c a t e ( Var ( nColumns ) )
534 A l l o c a t e ( GefFileName ( n l i n e s _ d a t a ) )
535 A l l o c a t e ( Boring_Code ( n l i n e s _ d a t a ) )
536 A l l o c a t e ( NEN5104_Code ( n l i n e s _ d a t a ) )
537 A l l o c a t e ( Sample_No ( n l i n e s _ d a t a ) )
538 A l l o c a t e ( Sample_Code ( n l i n e s _ d a t a ) )
539 A l l o c a t e ( Depth ( n l i n e s _ d a t a ) )
540
541 Read ( F i l e , ’ (A) ’ ) ! Skips headers
542
543 Do j = 1 , n l i n e s _ d a t a
544 Read ( F i l e , ’ (A) ’ ) L i n e
545
546 posmin = 1
547 posmax = −1
548 Count = 0
549
550 Do i =1 , nColumns
551
552 Pos = i n d e x ( L i n e ( Posmin : ) , " , " )
553 I f ( Pos == 0 ) Then
554 Var ( i ) = L i n e ( Posmin : )
555 Exit
556 End I f
557
558 Count = c o u n t + 1
559
560 I f ( Count == 5 ) e x i t
561
562 Posmax = Posmax + Pos
164 E. Code of the SampleSource Program

563 Var ( i ) = L i n e ( Posmin : Posmax )


564 Posmin = Posmin + Pos
565
566 End Do
567
568 Read ( Var ( 2 ) , ’ (A) ’ ) Boring_Code ( j )
569 Read ( Var ( 3 ) , ’ (A) ’ ) NEN5104_Code ( j )
570 Read ( Var ( 4 ) , ’ (A) ’ ) Sample_No ( j )
571
572 ! G i v i n g t h e g e f r e s u l t s t h e same c o d e a s u s e d i n t h e o t h e r f i l e s .
573
574 Code = Sample_No ( j )
575 Read ( Code ( Len ( t r i m ( Code ) ) − 1 : ) , ’ ( A2 ) ’ ) Number
576
577 I f ( I n d e x ( B o r i n g _ C o d e ( j ) , "A1" ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "DH" ) > 0 ) Then
578 Sample_Code ( j ) = "PB1DH−A1−65− " / / Number
579 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , "A3" ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "DH" ) > 0 ) Then
580 Sample_Code ( j ) = "PB1DH−A3−85− " / / Number
581 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , " B65 " ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "TXL" ) > 0 ) Then
582 Sample_Code ( j ) = "B−65−TXL− " / / Number
583 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , " C85 " ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "TXL" ) > 0 ) Then
584 Sample_Code ( j ) = "C−85−TXL− " / / Number
585 Else ! The v e r t i c a l f i l e o r o t h e r f i l e s .
586 Sample_Code ( j ) = t r i m ( B o r i n g _ C o d e ( j ) ) / / " − " / / t r i m ( Sample_No ( j ) )
587 ! W r i t e ( * , * ) Sample_Code ( j )
588 End I f
589
590 End Do
591
592 Rewind ( F i l e )
593
594 Read ( F i l e , * ) ! Skips headers
595 Do j = 1 , n L i n e s _ d a t a
596 count = 0
597 Do While ( . TRUE . )
598 Read ( F i l e , ’ (A) ’ , Advance = ’No ’ ) l i n e T e m p
599 ! W r i t e ( * , ’ (A) ’ ) l i n e T e m p
600 I f ( l i n e T e m p == ’ , ’ ) c o u n t = c o u n t + 1
601 I f ( c o u n t == 5 ) e x i t
602 End Do
603
604 Read ( F i l e , * ) D( j , : )
605 End Do
606
607 D e a l l o c a t e ( Var , GefFileName , Boring_Code , NEN5104_Code , Sample_No , Depth )
608
609 End S u b r o u t i n e
610
611 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
612 ! Finding a value
613 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
614
615 S u b r o u t i n e F i n d D a t e T i m e V a l u e A p p r o x ( Value , Array , I n d e x )
616 ! F i n d s a g i v e n v a l u e i n a g i v e n a r r a y o r an a p p r o x i m a t i o n .
617 ! Based on h t t p : / / r o s e t t a c o d e . o r g / w i k i / S e a r c h _ a _ l i s t # F o r t r a n
618 I m p l i c i t None
619
620 Character (19) , i n t e n t ( in ) :: Value
621 Character (19) :: Array ( : )
622 Integer :: Index
623 Integer :: Day_v , Month_v , Year_v , Hours_v , M i n u t e s _ v , S e c o n d s _ v
624 Integer :: Day_a , Month_a , Year_a , Hours_a , M i n u t e s _ a , S e c o n d s _ a
625 Character (1000) :: Message
626 Integer :: S a m p l e S o u r c e L o g =25
627
628 Write ( * , * )
629
630 DO I n d e x =1 , s i z e ( A r r a y )
631 I f ( V a l u e == A r r a y ( I n d e x ) ) Then
632 W r i t e ( Message , ’ (A, A, I 7 ) ’ ) Value , " i s f o u n d a t i n d e x : " , I n d e x
633 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
165

634 Return
635 Else
636 Read ( Value , ’ ( I 2 . 2 , 1 x , I 2 . 2 , 1 x , I4 , 1 x , I 2 . 2 , 1 x , I 2 . 2 , 1 x , I 2 . 2 ) ’ ) Day_v , Month_v , Year_v ,
Hours_v , M i n u t e s _ v , S e c o n d s _ v
637 Read ( A r r a y ( I n d e x ) , ’ ( I 2 . 2 , 1 x , I 2 . 2 , 1 x , I4 , 1 x , I 2 . 2 , 1 x , I 2 . 2 , 1 x , I 2 . 2 ) ’ ) Day_a , Month_a ,
Year_a , Hours_a , M i n u t e s _ a , S e c o n d s _ a
638
639 I f ( Day_v == Day_a . and . Month_v == Month_a . and . Year_v == Y e a r _ a . and . Hours_v ==
H o u r s _ a . and . M i n u t e s _ v == M i n u t e s _ a . and . S e c o n d s _ v <= S e c o n d s _ a ) Then
640 W r i t e ( Message , ’ (A, A, I7 , A, A19 , A) ’ ) Value , " i s n o t e x a c t l y f o u n d b u t a t p o s i t i o n " ,
Index , " , " , Array ( Index ) , " i s found . "
641 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
642 Return
643 End I f
644 End I f
645 End Do
646
647 W r i t e ( Message , ’ (A, A, A) ’ ) " E r r o r : " , Value , " i s n o t f o u n d i n g i v e n a r r a y . " ! Outside
t h e do l o o p o r e v e r y do would p r i n t t h i s t o t h e s c r e e n b e f o r e c o n t i n u i n g .
648 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
649 W r i t e ( Message , ’ (A) ’ ) " T h i s w i l l be due t o a m i s s i n g d a t a p a c k a g e , s w i t c h i n g t o method 2 .
"
650 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
651
652 C a l l F i n d A p p r o x D a t e T i m e ( Value , Array , I n d e x )
653
654 End S u b r o u t i n e
655
656 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
657
658 S u b r o u t i n e F i n d A p p r o x D a t e T i m e ( Value , Array , I n d e x )
659 ! C o n t r a r y t o t h e o t h e r r o u t i n e t h i s one i s b a s e d on f i n d i n g t h e minimum t i m e i n t e r v a l
b e t w e e n two d a t e t i m e v a l u e s
660 I m p l i c i t None
661
662 Character (19) :: Array ( : )
663 Character (19) :: Value
664 Integer :: Index , i , j
665 Integer :: TimeInt
666 Character (1000) :: Message
667 Integer :: S a m p l e S o u r c e L o g =25
668
669 Write ( * , * ) ! I n s e r t s an empty l i n e f o r e a s i e r r e a d i n g
670
671 Do i =1 ,60 ! D e v i a t i o n l o o p , maximum 1 h o u r and j u s t t a k e s t h e c l o s e s t
s i n c e TimeIntervalTwoValues r e t u r n s t h e a b s o l u t d i f f e r e n c e i n seconds , so found v a l u e can
be h i g h e r o r l o w e r t h a n i n i t i a l v a l u e b u t i t i s t h e c l o s e s t .
672 Do j =1 , s i z e ( A r r a y ) ! Array loop , c y c l e s t h r o u g h t h e a r r a y f o r t h e given d e v i a t i o n
673
674 C a l l T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t , Value , A r r a y ( j ) )
675
676 I f ( T i m e I n t <= ( i * 6 0 ) ) Then
677 W r i t e ( Message , ’ (A, A, A, I2 , A) ’ ) " The c l o s e s t t o v a l u e " , Value , " , minimum
d e v i a t i o n of " , i , " minutes , "
678 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , SampleSourceLog )
679 W r i t e ( Message , ’ (A, A, A, I 6 . 6 ) ’ ) " i s f o u n d t o be " , Array ( j ) , " a t index " , j
680 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , SampleSourceLog )
681 Index = j
682 Return
683 End I f
684 End Do
685 End Do
686
687 W r i t e ( Message , ’ (A, I3 , A) ’ ) "No s o l u t i o n i s f o u n d w i t h i n a maximum d e v i a t i o n o f " , i , " m i n u t e s . "
688 Index = 0
689
690 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , S a m p l e S o u r c e L o g )
691
692 End S u b r o u t i n e
693
694 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
166 E. Code of the SampleSource Program

695 ! Conversion Subroutines


696 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
697
698 S u b r o u t i n e D a t e T i m e I n t e g e r A r r a y ( DateTime , Day , Month , Year , Hours , M i n u t e s , S e c o n d s )
699 ! C o n v e r t s an a r r a y o f c h a r a c t e r s t r i n g s o f f o r m a t " dd −mm− yyyy hh :mm: s s " i n t o i n t e g e r s t o
be c a l c u l a t e d w i t h .
700 I m p l i c i t None
701
702 C h a r a c t e r ( l e n =19) :: DateTime ( : )
703 Integer (2) , allocatable :: Day ( : ) , Month ( : ) , Hours ( : ) , M i n u t e s ( : ) , S e c o n d s ( : )
704 Integer (4) , allocatable :: Year ( : )
705 Integer :: i
706
707 A l l o c a t e ( Day ( s i z e ( DateTime ) ) )
708 A l l o c a t e ( Month ( s i z e ( DateTime ) ) )
709 A l l o c a t e ( Year ( s i z e ( DateTime ) ) )
710 A l l o c a t e ( Hours ( s i z e ( DateTime ) ) )
711 A l l o c a t e ( M i n u t e s ( s i z e ( DateTime ) ) )
712 A l l o c a t e ( S e c o n d s ( s i z e ( DateTime ) ) )
713
714 Do i =1 , s i z e ( DateTime )
715 Read ( DateTime ( i ) , ’ ( I2 , 1 x , I2 , 1 x , I4 , 1 x , I2 , 1 x , I2 , 1 x , I 2 ) ’ ) Day ( i ) , Month ( i ) , Year ( i ) , Hours ( i ) ,
Minutes ( i ) , Seconds ( i )
716 End Do
717
718 End S u b r o u t i n e
719
720 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
721
722 S u b r o u t i n e D a t e T i m e I n t e g e r S i n g l e ( D a t e T i m e S i n g l e , Day , Month , Year , Hours , M i n u t e s , S e c o n d s )
723 ! C o n v e r t s a c h a r a c t e r s t r i n g o f f o r m a t " dd −mm− yyyy hh :mm: s s " i n t o i n t e g e r s t o be
c a l c u l a t e d with .
724 I m p l i c i t None
725
726 C h a r a c t e r ( l e n =19) :: DateTimeSingle
727 Integer (2) :: Day , Month , Hours , M i n u t e s , S e c o n d s
728 Integer (4) :: Year
729
730 Read ( D a t e T i m e S i n g l e , ’ ( I2 , 1 x , I2 , 1 x , I4 , 1 x , I2 , 1 x , I2 , 1 x , I 2 ) ’ ) Day , Month , Year , Hours , M i n u t e s ,
Seconds
731
732 End S u b r o u t i n e
733
734 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
735
736 S u b r o u t i n e D a t e T i m e I n t e g e r S i n g l e B a s i c ( D a t e T i m e S i n g l e , Day , Month )
737 ! C o n v e r t s a c h a r a c t e r s t r i n g o f f o r m a t " dd −mm− yyyy hh :mm: s s " i n t o i n t e g e r s t o be
c a l c u l a t e d with .
738 I m p l i c i t None
739
740 C h a r a c t e r ( l e n =19) :: DateTimeSingle
741 Integer (2) :: Day , Month
742
743 Read ( D a t e T i m e S i n g l e , ’ ( I2 , 1 x , I 2 ) ’ ) Day , Month
744
745 End S u b r o u t i n e
746
747 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
748
749 S u b r o u t i n e DateTimeFromSur ( DateTime_Sur , D a t e _ I , Time_R , N l i n e s _ s u r )
750 ! C o n v e r t s t h e D a t e _ I en Time_R t o one v e c t o r , which c a n be s e a r c h e d and h a s t h e same
f o r m a t a s t h e one r e a d from P r o d a t a .
751 ! The c o n v e r s i o n from e x c e l no . t o dd /mm/ yyyy i s p a r t i a l l y b a s e d on h t t p : / / www. c o d e p r o j e c t .
com / A r t i c l e s / 2 7 5 0 / E x c e l − s e r i a l − d a t e − t o −Day−Month − Year − and − v i s e − v e r s a
752 I m p l i c i t None
753
754 Character (19) , Allocatable :: DateTime_Sur ( : )
755 Integer (2) , Allocatable :: Day_L ( : ) , Month_L ( : ) , Hours_L ( : ) , M i n u t e s _ L ( : ) , Seconds_L ( : )
756 Integer (4) , Allocatable :: Year_L ( : )
757 Integer :: i , j , Nlines_sur
758 Integer :: Date_I ( : )
167

759 Real :: Time_R ( : )


760 Real :: l ,n,z ,y
761
762 A l l o c a t e ( Day_L ( N l i n e s _ s u r ) )
763 A l l o c a t e ( Month_L ( N l i n e s _ s u r ) )
764 A l l o c a t e ( Year_L ( N l i n e s _ s u r ) )
765 A l l o c a t e ( Hours_L ( N l i n e s _ s u r ) )
766 A l l o c a t e ( Minutes_L ( N l i n e s _ s u r ) )
767 A l l o c a t e ( Seconds_L ( N l i n e s _ s u r ) )
768 A l l o c a t e ( DateTime_Sur ( N l i n e s _ s u r ) )
769
770 Do i =1 , N l i n e s _ S u r
771
772 I f ( D a t e _ I ( i ) == 6 0 ) Then
773 Day_L = 29
774 Month_L = 2
775 Year_L = 1900
776
777 Else
778 I f ( D a t e _ I ( i ) < 6 0 ) Then
779 D a t e _ I ( i ) = D a t e _ I ( i ) +1
780 End I f
781
782 l = D a t e _ I ( i ) + 68569 + 2415019
783
784 n = f l o o r ( ( 4 * l ) / 146097)
785 l = l − f l o o r ( ( 146097 * n + 3 ) / 4 )
786
787 z = f l o o r ( ( 4000 * ( l + 1 ) ) / 1 4 6 1 0 0 1 )
788 l = l − f l o o r ( ( 1461 * z ) / 4 ) + 31
789 y = f l o o r ( ( 80 * l ) / 2 4 4 7 )
790
791 Day_L = l − f l o o r ( ( 2447 * y ) / 8 0 )
792
793 l = f l o o r ( y / 11)
794
795 Month_L = y + 2 − ( 12 * l )
796 Year_L = 100 * ( n − 49 ) + z + l
797 End I f
798
799 Hours_L ( i ) = i n t ( mod ( Time_R ( i ) * 2 4 . 0 , 6 0 . 0 ) )
800 Minutes_L ( i ) = i n t ( mod ( Time_R ( i ) * 1 4 4 0 . 0 , 6 0 . 0 ) )
801 Seconds_L ( i ) = n i n t ( mod ( Time_R ( i ) * 8 6 4 0 0 . 0 , 6 0 . 0 ) ) ! Due t o p o s s i b l e e r r o r s when
taking the only the i n t e g e r p a r t f o r seconds , the seconds are rounded towards the n e a r e s t
integer .
802
803 I f ( Seconds_L ( i ) == 6 0 ) Then ! A d d i t i o n a l s e c u r i t y measure , t o
assure r e a l i s t i c values .
804 Minutes_L ( i ) = Minutes_L ( i ) + 1
805 Seconds_L ( i ) = 0
806 End I f
807
808 W r i t e ( D a t e T i m e _ S u r ( i ) , ’ ( I 2 . 2 , A1 , I 2 . 2 , A1 , I4 , 1 x , I 2 . 2 , A1 , I 2 . 2 , A1 , I 2 . 2 ) ’ ) Day_L ( i ) , " − " , Month_L ( i )
, " − " , Year_L ( i ) , Hours_L ( i ) , " : " , M i n u t e s _ L ( i ) , " : " , Seconds_L ( i )
809
810 End Do
811
812 End S u b r o u t i n e
813
814 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
815
816 S u b r o u t i n e SecToTimeR ( TimeInS , HH,MM, SS )
817 ! C a l c u l a t e s t h e t i m e i n s e c o n d s t o HH:MM: SS
818 I m p l i c i t None
819
820 Real :: TimeInS
821 Integer :: HH,MM, SS
822
823 HH = i n t ( TimeInS / 3 6 0 0 )
824 MM = i n t ( ( TimeInS −HH* 3 6 0 0 ) / 6 0 )
825 SS = i n t ( TimeInS −HH* 3600 −MM* 6 0 )
168 E. Code of the SampleSource Program

826
827 End S u b r o u t i n e
828
829 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
830
831 S u b r o u t i n e SecToTimeI ( TimeInS , HH,MM, SS )
832 ! C a l c u l a t e s t h e t i m e i n s e c o n d s t o HH:MM: SS
833 I m p l i c i t None
834
835 Integer :: TimeInS
836 Integer :: HH,MM, SS
837
838 HH = i n t ( TimeInS / 3 6 0 0 )
839 MM = i n t ( ( TimeInS −HH* 3 6 0 0 ) / 6 0 )
840 SS = i n t ( TimeInS −HH* 3600 −MM* 6 0 )
841
842 End S u b r o u t i n e
843
844 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
845
846 S u b r o u t i n e ZoomGPDays ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , X)
847 ! C a l c u l a t e s t h e t i m e min and max b a s e d on i n t e r v a l o f X d a y s
848 I m p l i c i t None
849
850 Character (19) :: D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax
851 Integer :: X
852 Integer (2) :: Day , Day_Min , Day_Max
853 Integer (2) :: Month , Month_Min , Month_Max
854 Integer (4) :: Year
855 Integer (2) :: Hours , M i n u t e s , S e c o n d s
856
857 Read ( D a t e T i m e S o u r c e , ’ ( I2 , 1 x , I2 , 1 x , I4 , 1 x , I2 , 1 x , I2 , 1 x , I 2 ) ’ ) Day , Month , Year , Hours , M i n u t e s ,
Seconds
858
859 Day_Min = Day − X
860 Month_Min = Month
861
862 ! Day_Min c a n become 0 o r l e s s s o t h a n t h e month h a s t o be r e d u c e d and day_min becomes t h e
l a s t o r t h e x t o l a s t day o f t h a t month .
863 I f ( Day_Min < 1 ) Then
864 I f ( ( Month − 1) == 1 . o r . ( Month − 1) == 3 . o r . ( Month − 1) == 5 . o r . ( Month − 1) == 7 . o r . (
Month − 1) == 8 . o r . ( Month − 1) == 10 . o r . ( Month − 1) == 1 2 ) Then
865 Day_Min = 31 − Day_Min
866 Month_Min = Month − 1
867 E l s e I f ( ( Month − 1) == 4 . o r . ( Month − 1) == 6 . o r . ( Month − 1) == 9 . o r . ( Month − 1) == 1 1 )
Then
868 Day_Min = 30 − Day_Min
869 Month_Min = Month − 1
870 E l s e I f ( ( Month − 1) == 2 ) Then
871 Day_Min = 28 − Day_Min
872 Month_Min = Month − 1
873 End I f
874 End I f
875
876 W r i t e ( DateTimeMin , ’ ( I 2 . 2 , A1 , I 2 . 2 , A1 , I4 , 1 x , I 2 . 2 , A1 , I 2 . 2 , A1 , I 2 . 2 ) ’ ) Day_Min , " − " , Month_Min , " − " ,
Year , Hours , " : " , M i n u t e s , " : " , S e c o n d s
877 W r i t e ( * , * ) DateTimeMin
878
879 Day_Max = Day + X
880 Month_Max = Month
881
882 I f ( Day_Max > 3 1 ) Then
883 I f ( ( Month ) == 1 . o r . ( Month ) == 3 . o r . ( Month ) == 5 . o r . ( Month ) == 7 . o r . ( Month ) == 8
. o r . ( Month ) == 10 . o r . ( Month ) == 1 2 ) Then
884 Day_Max = Day_Max − 31
885 Month_Max = Month + 1
886 E l s e I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
887 Day_Max = Day_Max − 30
888 Month_Max = Month + 1
889 E l s e I f ( ( Month ) == 2 ) Then
890 Day_Max = Day_Max − 28
169

891 Month_Max = Month + 1


892 End I f
893 E l s e I f ( Day_Max > 3 0 ) Then
894 I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
895 Day_Max = Day_Max − 30
896 Month_Max = Month + 1
897 E l s e I f ( ( Month ) == 2 ) Then
898 Day_Max = Day_Max − 28
899 Month_Max = Month + 1
900 End I f
901 E l s e I f ( Day_Max > 2 8 ) Then
902 I f ( Month == 2 ) Then
903 Day_Max = Day_Max − 28
904 Month_Max = Month + 1
905 End I f
906 End I f
907
908 W r i t e ( DateTimeMax , ’ ( I 2 . 2 , A1 , I 2 . 2 , A1 , I4 , 1 x , I 2 . 2 , A1 , I 2 . 2 , A1 , I 2 . 2 ) ’ ) Day_Max , " − " , Month_Max , " − " ,
Year , Hours , " : " , M i n u t e s , " : " , S e c o n d s
909 W r i t e ( * , * ) DateTimeMax
910
911 End S u b r o u t i n e
912
913 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
914
915 S u b r o u t i n e ZoomGPHours ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , Y)
916 ! C a l c u l a t e s t h e t i m e min and max b a s e d on i n t e r v a l o f Y h o u r s
917 I m p l i c i t None
918
919 Character (19) :: D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax
920 Integer :: Y
921 Integer (2) :: Hours , Hours_Min , Hours_Max
922 Integer (2) :: Day , Day_Min , Day_Max
923 Integer (2) :: Month , Month_Min , Month_Max
924 Integer (4) :: Year
925 Integer (2) :: Minutes , Seconds
926
927 Read ( D a t e T i m e S o u r c e , ’ ( I2 , 1 x , I2 , 1 x , I4 , 1 x , I2 , 1 x , I2 , 1 x , I 2 ) ’ ) Day , Month , Year , Hours , M i n u t e s ,
Seconds
928
929 Hours_Min = Hours − Y
930 Day_Min = Day
931 Month_Min = Month
932
933 I f ( Hours_Min < 0 ) Then
934 Hours_Min = 24 + Hours_min
935 Day_Min = Day_Min − 1
936 End I f
937
938 ! Day_Min c a n become 0 o r l e s s s o t h a n t h e month h a s t o be r e d u c e d and day_min becomes t h e
l a s t o r t h e x t o l a s t day o f t h a t month .
939 I f ( Day_Min < 1 ) Then
940 I f ( ( Month − 1) == 1 . o r . ( Month − 1) == 3 . o r . ( Month − 1) == 5 . o r . ( Month − 1) == 7 . o r . (
Month − 1) == 8 . o r . ( Month − 1) == 10 . o r . ( Month − 1) == 1 2 ) Then
941 Day_Min = 31 + Day_Min
942 Month_Min = Month − 1
943 E l s e I f ( ( Month − 1) == 4 . o r . ( Month − 1) == 6 . o r . ( Month − 1) == 9 . o r . ( Month − 1) == 1 1 )
Then
944 Day_Min = 30 + Day_Min
945 Month_Min = Month − 1
946 E l s e I f ( ( Month − 1) == 2 ) Then
947 Day_Min = 28 + Day_Min
948 Month_Min = Month − 1
949 End I f
950 End I f
951
952 W r i t e ( DateTimeMin , ’ ( 2 ( I 2 . 2 , A1 ) , I4 , 1 x , 2 ( I 2 . 2 , A1 ) , I 2 . 2 ) ’ ) Day_Min , " − " , Month_Min , " − " , Year ,
Hours_Min , " : " , M i n u t e s , " : " , S e c o n d s
953
954 Hours_Max = Hours + Y
955 Day_Max = Day
170 E. Code of the SampleSource Program

956 Month_Max = Month


957
958 I f ( Hours_Max > 2 3 ) Then ! 2 3 : 5 9 becomes 0 0 : 0 0 t h e n e x t day
959 Hours_Max = Hours_Max − 24
960 Day_Max = Day_Max + 1
961 End I f
962
963 I f ( Day_Max > 3 1 ) Then
964 I f ( ( Month ) == 1 . o r . ( Month ) == 3 . o r . ( Month ) == 5 . o r . ( Month ) == 7 . o r . ( Month ) == 8
. o r . ( Month ) == 10 . o r . ( Month ) == 1 2 ) Then
965 Day_Max = Day_Max − 31
966 Month_Max = Month + 1
967 E l s e I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
968 Day_Max = Day_Max − 30
969 Month_Max = Month + 1
970 E l s e I f ( ( Month ) == 2 ) Then
971 Day_Max = Day_Max − 28
972 Month_Max = Month + 1
973 End I f
974 E l s e I f ( Day_Max > 3 0 ) Then
975 I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
976 Day_Max = Day_Max − 30
977 Month_Max = Month + 1
978 E l s e I f ( ( Month ) == 2 ) Then
979 Day_Max = Day_Max − 28
980 Month_Max = Month + 1
981 End I f
982 E l s e I f ( Day_Max > 2 8 ) Then
983 I f ( Month == 2 ) Then
984 Day_Max = Day_Max − 28
985 Month_Max = Month + 1
986 End I f
987 End I f
988
989 W r i t e ( DateTimeMax , ’ ( 2 ( I 2 . 2 , A1 ) , I4 , 1 x , 2 ( I 2 . 2 , A1 ) , I 2 . 2 ) ’ ) Day_Max , " − " , Month_Max , " − " , Year ,
Hours_Max , " : " , M i n u t e s , " : " , S e c o n d s
990
991 End S u b r o u t i n e
992
993 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
994
995 S u b r o u t i n e T i m e I n t e r v a l _ P D ( T i m e I n t , DateTime , Index_PD )
996 ! C a l c u l a t e s t h e t i m e i n t e r v a l s b e t w e e n t h e d a t a p o i n t s . S t a r t i n g from t o p o f DateTime
vector .
997 ! Change t o o n l y a r o u n d p o i n t N i f c a l c u l a t i o n t i m e becomes u n f e a s i b l e .
998 I m p l i c i t None
999
1000 Integer , allocatable :: TimeInt ( : ) ! [s]
1001 C h a r a c t e r ( l e n =19) :: DateTime ( : )
1002 Integer (2) , allocatable :: Day ( : ) , Month ( : ) , Hours ( : ) , M i n u t e s ( : ) , S e c o n d s ( : )
1003 Integer (4) , allocatable :: Year ( : )
1004 Integer :: i, j
1005 Integer :: Index_PD
1006 Integer :: DaysMonth
1007
1008 C a l l D a t e T i m e I n t e g e r A r r a y ( DateTime , Day , Month , Year , Hours , M i n u t e s , S e c o n d s )
1009
1010 A l l o c a t e ( T i m e I n t ( Index_PD ) )
1011
1012 TimeInt ( 1) = 0 ! Trick to enable forward c a l c u l a t i o n of the t i m e i n t e r v a l s
1013
1014 Do i = 1 , ( Index_PD − 1)
1015 j = Index_PD+1− i
1016
1017 I f ( Month ( j ) == 1 . o r . Month ( j ) == 3 . o r . Month ( j ) == 5 . o r . Month ( j ) == 7 . o r . Month ( j )
== 8 . o r . Month ( j ) == 10 . o r . Month ( j ) == 1 2 ) Then
1018 DaysMonth = 31
1019 E l s e I f ( Month ( j ) == 2 ) Then
1020 DaysMonth = 28 ! TO BE DONE: t a k e l e a p y e a r s i n t o a c c o u n t .
1021 E l s e I f ( Month ( j ) == 4 . o r . Month ( j ) == 6 . o r . Month ( j ) == 9 . o r . Month ( j ) == 1 1 ) Then
1022 DaysMonth = 30
171

1023 End I f
1024
1025 T i m e I n t ( j ) = ( ( ( Month ( j ) − Month ( j − 1) ) * ( DaysMonth * 24 * 60 * 6 0 ) ) + ( ( Day ( j ) −Day ( j − 1) ) * ( 2 4 * 60 * 6 0 ) )
+ ( ( Hours ( j ) − Hours ( j − 1) ) * ( 6 0 * 6 0 ) ) + ( ( M i n u t e s ( j ) − M i n u t e s ( j − 1) ) * 6 0 ) + ( S e c o n d s ( j ) − S e c o n d s ( j − 1) )
)
1026 I f ( T i m e I n t ( j ) >= ( 1 2 * 60 * 6 0 ) ) Then ! S e c u r i t y measure f o r t h e f a c t t h a t t h e
d r i l l i n g was i n 12 h o u r s s h i f t s most o f t h e t i m e . An i n t e r v a l o f 12+ h o u r s w i l l c a u s e
d e v a t i o n s f u r t h e r on i n t h e p r o g r a m .
1027 T i m e I n t ( j ) = T i m e I n t ( j ) − ( 1 2 * 60 * 6 0 )
1028 End I f
1029 I f ( T i m e I n t ( j ) >= ( 1 0 * 6 0 ) ) Then ! S e c u r i t y measure f o r t h e f a c t t h a t sometimes
d a t a i n p a c k a g e s o f 10 min . i s m i s s i n g .
1030 TimeInt ( j ) = (5 * 60) ! Not e n t i r e l y t r u e , c a n c a u s e a s l i g h t
d e v i a t i o n i n t h e t r a v e l t i m e and t h u s i n t h e s o u r c e l o c a t i o n .
1031 End I f ! I t now t a k e s 5 m i n u t e s i n s t e a d o f 10 m i n u t e s
o f w h a t e v e r i t was d o i n g ( f u l l pumping − no pumping ) a t t h e moment t h e i n t e r v a l STOPS ,
s i n c e t h e Pumped volume i s b a c k c a l c u l a t e d .
1032 ! F o r two m i s s i n g d a t a p a c k a g e s i n a row
(08 − 09 − 2015 0 8 : 1 4 − 0 8 : 3 4 ) t h e d e v a t i o n i s o f c o u r s e l a r g e r .
1033 End Do
1034
1035 End S u b r o u t i n e
1036
1037 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1038
1039 S u b r o u t i n e T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t , DateTime1 , DateTime2 , O p t i o n )
1040 ! C a l c u l a t e s t h e t i m e i n t e r v a l s b e t w e e n two d a t e t i m e v a l u e s i n [ s ] , i n d e p e n d e n t o f which i s
larger .
1041 I m p l i c i t None
1042
1043 Integer :: TimeInt ! [s]
1044 Character (19) :: DateTime1 , DateTime2
1045 Integer (2) :: Day1 , Month1 , Hours1 , M i n u t e s 1 , S e c o n d s 1
1046 Integer (4) :: Year1
1047 Integer (2) :: Day2 , Month2 , Hours2 , M i n u t e s 2 , S e c o n d s 2
1048 Integer (4) :: Year2
1049 Integer :: C1 , C2 , C3 , C4 , C5 , C6
1050 Integer , Optional :: Option
1051
1052 C a l l D a t e T i m e I n t e g e r S i n g l e ( DateTime1 , Day1 , Month1 , Year1 , Hours1 , M i n u t e s 1 , S e c o n d s 1 )
1053 C a l l D a t e T i m e I n t e g e r S i n g l e ( DateTime2 , Day2 , Month2 , Year2 , Hours2 , M i n u t e s 2 , S e c o n d s 2 )
1054
1055 I f ( Month1 == 1 . o r . Month1 == 3 . o r . Month1 == 5 . o r . Month1 == 7 . o r . Month1 == 8 . o r .
Month1 ==10 . o r . Month1 == 1 2 ) Then ! Jan , Mar , May , J u l , Aug , Oct , Dec
1056 C2 = 31 * 24 * 60 * 60
1057 E l s e i f ( Month1 == 2 ) Then ! Feb
1058 C2 = 28 * 24 * 60 * 60
1059 Else ! Apr , Jun , Sep , Nov
1060 C2 = 30 * 24 * 60 * 60
1061 End i f
1062
1063 C3 = 24 * 60 * 60 ! Hours i n a day a r e c o n s t a n t , 24
1064 C4 = 60 * 60 ! M i n u t e s i n a h o u r a r e c o n s t a n t , 60
1065 C5 = 60 ! S e c o n d s i n a m i n u t e a r e c o n s t a n t , 60
1066
1067 I f ( P r e s e n t ( O p t i o n ) ) Then
1068 T i m e I n t = ( ( ( Month1 − Month2 ) * ( C2 ) ) + ( ( Day1 −Day2 ) * ( C3 ) ) + ( ( Hours1 − Hours2 ) * ( C4 ) ) + ( ( M i n u t e s 1 −
M i n u t e s 2 ) * C5 ) + ( Seconds1 − S e c o n d s 2 ) )
1069 Else
1070 T i m e I n t = a b s ( ( ( Month1 − Month2 ) * ( C2 ) ) + ( ( Day1 −Day2 ) * ( C3 ) ) + ( ( Hours1 − Hours2 ) * ( C4 ) ) + ( ( M i n u t e s 1
− M i n u t e s 2 ) * C5 ) + ( Seconds1 − S e c o n d s 2 ) )
1071 End I f
1072
1073 End S u b r o u t i n e
1074
1075 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1076
1077 S u b r o u t i n e GeometryBoreH ( PI , D_bh , D_ds , A_bh , A_ds , A _ a n n u l u s )
1078 ! C a l c u l a t e s the geometry
1079 I m p l i c i t None
1080
172 E. Code of the SampleSource Program

1081 Real ( 8 ) : : PI
1082 Real :: D_bh , D_ds
1083 Real :: A_bh , A_ds , A _ a n n u l u s
1084
1085 A_bh = P I / 4 * D_bh * * 2
1086 A_ds = P I / 4 * D_ds * * 2
1087 A_annulus = A_bh−A_ds
1088
1089 End S u b r o u t i n e
1090
1091 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1092 ! Calculations − Preparations
1093 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1094 ! Fluid Parameters
1095 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1096 ! Herschel −B u l k l e y
1097 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1098
1099 S u b r o u t i n e H e r s c h e l _ B u l k l e y (X, Y, T a u _ Y i e l d , K, n , Min_Alpha , Min_Delta , Sample_Code , MainI ,
C o n v e r s i o n _ D e g r _ P a , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , GammaY , Tau ,
Tau_Calc_All , Alpha_All , D e l t a _ A l l )
1100 ! Based on h t t p : / / www. eng . umd . edu / ~ nsw / c h b e 2 5 0 / s l o p e . htm , and i s u s e d t o r e p l a c e t h e
i n t e r c e p t and s l o p e f u n c t i o n a s f o u n d i n e x c e l .
1101 I m p l i c i t None
1102
1103 Integer : : RPM_600 ( : ) , RPM_300 ( : ) , RPM_200 ( : ) , RPM_100 ( : ) , RPM_60 ( : ) , RPM_30 ( : ) ,RPM_6 ( : ) ,
RPM_3 ( : )
1104 Real :: Conversion_Degr_Pa
1105 Integer :: MainI
1106 Real ( 8 ) : : X ( : ) ,Y ( : )
1107 Real : : K, n
1108 Real , D i m e n s i o n ( 2 0 ) : : K_All , n _ A l l
1109 Real :: A
1110 Real : : SumX , SumY
1111 Real : : SumXX, SumXY
1112 Real : : X_Average , Y_Average
1113 Integer :: i, j
1114 Integer :: Index
1115 Real :: Tau_Calc
1116 Real ( 8 ) , Dimension ( 2 0 ) :: Tau_Calc_All
1117 Real : : Min_Alpha
1118 Real :: Alpha ! S c a l i n g f a c t o r on t a u _ y i e l d t o d e t e r m i n e t h e
minimum d e l t a .
1119 Real ( 8 ) , Dimension ( 2 0 ) :: Alpha_All
1120 Real :: Min_Delta
1121 Real :: Delta ! D e v i a t i o n b e t w e e n t h e m e a s u r e d and c a l c u l a t e d
v a l u e s , sum ( ( t a u − t a u _ c a l c ) ^ 2 ) .
1122 Real ( 8 ) , Dimension ( 2 0 ) :: Delta_All
1123 Real ( 8 ) , Dimension ( 2 0 ) : : Tau
1124 Character (*) : : Sample_Code
1125 Real ( 8 ) , dimension ( 8 ) : : GammaY
1126 Real :: Tau_Yield
1127 Real , D i m e n s i o n ( 2 0 ) :: Tau_Yield_All
1128
1129 Tau ( 1 ) = ( RPM_3 ( MainI ) * Conversion_Degr_Pa )
1130 Tau ( 2 ) = ( RPM_6 ( MainI ) * Conversion_Degr_Pa )
1131 Tau ( 3 ) = ( RPM_30 ( MainI ) * Conversion_Degr_Pa )
1132 Tau ( 4 ) = ( RPM_60 ( MainI ) * Conversion_Degr_Pa )
1133 Tau ( 5 ) = ( RPM_100 ( MainI ) * Conversion_Degr_Pa )
1134 Tau ( 6 ) = ( RPM_200 ( MainI ) * Conversion_Degr_Pa )
1135 Tau ( 7 ) = ( RPM_300 ( MainI ) * Conversion_Degr_Pa )
1136 Tau ( 8 ) = ( RPM_600 ( MainI ) * Conversion_Degr_Pa )
1137
1138 Delta = 0 . d0
1139 Do j = 1 , 2 0 ! Taking t a u _ y i e l d = 1* t a u _ y i e l d d i s t o r t s t h e r e s u l t s
1140 Alpha = j * 0 . 0 5 d0
1141 Tau_yield = Alpha * RPM_3 ( MainI ) * C o n v e r s i o n _ D e g r _ P a
1142
1143 Do i = 1 , s i z e (Y)
1144 I f ( ( Tau ( i ) − T a u _ y i e l d ) == 0 ) Then
1145 Y( i ) = 0 d0 ! TO BE DONE, d e c i d e w h e t h e r t h i s o r n o t t a k i n g i t i n t o
173

a c c o u n t i s more a c c u r a t e . . .
1146 Else
1147 Y( i ) = Log10 ( Tau ( i ) − T a u _ y i e l d )
1148 End I f
1149 End Do
1150
1151 SumX = 0 . d0
1152 SumY = 0 . d0
1153
1154 Do i =1 , S i z e (X)
1155 SumX = SumX + X( i )
1156 SumY = SumY + Y( i )
1157 SumXX = SumXX + X( i ) *X( i )
1158 SumXY = SumXY + X( i ) *Y( i )
1159 End Do
1160
1161 X_Average = SumX / f l o a t ( s i z e (X) )
1162 Y_Average = SumY / f l o a t ( s i z e (X) )
1163
1164 n = (SumXY − SumX* Y_Average ) / (SumXX − SumX* X_Average )
1165 A = Y_Average − n * X_Average
1166 K = 10 * *A
1167
1168 Delta = 0 ! R e s e t s t h e v a l u e from t h e p r e v i o u s l o o p , w / o i t t h e d e l t a
would o n l y i n c r e a s e
1169 Do i =1 , S i z e (GammaY)
1170 Tau_Calc = T a u _ Y i e l d + K*GammaY( i ) * * n
1171 Delta = Delta + ( Tau ( i ) − T a u _ C a l c ) * * 2 . d0
1172 End Do
1173
1174 K_All ( j ) = K
1175 n_All ( j ) = n
1176
1177 Tau_Yield_All ( j ) = Tau_Yield
1178 Delta_All ( j ) = Delta
1179 Alpha_All ( j ) = Alpha
1180 End Do
1181
1182 Index = Minloc ( D e l t a _ A l l , 1 )
1183 Min_Delta = Delta_All ( Index )
1184 Min_Alpha = Index * 0.05
1185
1186 K = K_All ( I n d e x )
1187 n = n_All ( Index )
1188 Tau_Yield = Tau_Yield_All ( Index )
1189
1190 Do i = 1 , s i z e (GammaY)
1191 Tau_Calc_All ( i ) = Tau_Yield_All ( Index ) + K_All ( I n d e x ) * GammaY( i ) * * n _ A l l ( I n d e x )
1192 End Do
1193
1194 ! C a l l f 2 g p 6 ( Sample_Code , GammaY , Tau , ’ 3 a ’ , GammaY , T a u _ C a l c _ A l l , ’ 3 b ’ , 1 , ’ S h e a r R a t e [ − ] ’ , ’ R e a d i n g
[ Pa ] ’ , ’ M e a s u r e m e n t s v s . C a l c u l a t e d ’ , ’ Measurements ’ , ’ C a l c u l a t e d ’ )
1195 ! C a l l f 2 g p 5 ( Sample_Code , A l p h a _ A l l , D e l t a _ A l l , ’ 2 a ’ , 1 , ’ Alpha [ − ] ’ , ’ D e l t a [ Pa ] ’ , ’ Alpha v s . D e l t a
’ , ’ Delta ’ )
1196
1197 End S u b r o u t i n e
1198
1199 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1200 ! Bingham
1201 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1202 S u b r o u t i n e Bingham ( MainI , PV , YP , RPM_600 , RPM_300 , C o n v e r s i o n _ D e g r _ l b , C o n v e r s i o n _ l b _ P a ,
Conversion_RPM_PerS , GammaY , Tau_Calc_BH , Tau , D e l t a )
1203 ! C a l c u l a t e s Bingham p a r a m e t e r s
1204 ! PV and YP a r e b o t h i n [ Pa ] , YP i s u s e d a s T a u _ y i e l d
1205 I m p l i c i t None
1206
1207 Integer : : RPM_600 ( : ) , RPM_300 ( : )
1208 Integer :: MainI
1209 Real : : PV , YP
1210 Real :: C o n v e r s i o n _ D e g r _ l b , C o n v e r s i o n _ l b _ P a , Conversion_RPM_PerS
1211 Real ( 8 ) , dimension ( 8 ) : : GammaY
174 E. Code of the SampleSource Program

1212 Real ( 8 ) , Dimension ( 2 0 ) : : Tau_Calc_BH


1213 Real :: Delta ! D e v i a t i o n b e t w e e n t h e m e a s u r e d and c a l c u l a t e d
v a l u e s , sum ( ( t a u − t a u _ c a l c ) ^ 2 ) .
1214 Real ( 8 ) , Dimension ( 2 0 ) : : Tau
1215 Integer :: i
1216
1217 PV = ( ( RPM_600 ( MainI ) −RPM_300 ( MainI ) ) * C o n v e r s i o n _ D e g r _ l b * C o n v e r s i o n _ l b _ P a ) / ( 6 0 0 *
Conversion_RPM_PerS − 300 * Conversion_RPM_PerS )
1218 YP = ( RPM_300 ( MainI ) − ( RPM_600 ( MainI ) − RPM_300 ( MainI ) ) ) * C o n v e r s i o n _ D e g r _ l b *
Conversion_lb_Pa
1219
1220 Delta = 0
1221 Do i = 1 , s i z e (GammaY)
1222 Tau_Calc_BH ( i ) = YP + PV * GammaY( i )
1223 Delta = Delta + ( Tau ( i ) − Tau_Calc_BH ( i ) ) * * 2 . d0
1224 End Do
1225
1226 End S u b r o u t i n e
1227
1228 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1229 ! C a l c u l a t i o n s − Main
1230 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1231 S u b r o u t i n e T r a n s p o r t L e n g t h _ P D ( PumpVol , Index_PD , A_bh , TranspLen , TranspLenSum , TimeInt_PD , MudFlw ,
Loss )
1232 ! C a l c u l a t e s t h e amount o f t h a t i s a c t u a l l y pumped , f l o w r a t e * t i m e i n t e r v a l
1233 ! Volume d r i l l e d s o i l c a n be c o n s i d e r e d a s e q u a l t o t h e amount o f d r i l l i n g f l u i d n e c e s s a r y
t o f i l l t h a t h o l e , t h i s means t h a t l o s s i n volume o c c u r s when c o n s i d e r i n g t h e whole
s y s t e m n o t when c o n s i d e r i n g t h e h o l e a l o n e .
1234 ! S i n c e t h e d r i l l e d s o i l i s r e c y c l e d and t h u s removed from t h e f l u i d . Ground w a t e r however
r e m a i n s i n t h e f l u i d , s o e x c l u d i n g t h e f i l t r a t i o n l o s s l e s s o f a l o s s t h a n t h e volume o f
...
1235 ! . . . t h e d r i l l e d s o i l a l t h o u g h a d d i t i o n a l T e q g e l o r OCMA i s r e q u i r e d t o m a i n t a i n t h e
p r o p e r t i e s o f t h e d r i l l i n g f l u i d . Some f l u i d and b e n t o n i t e w i l l a l s o be l o s t due t o t h e
recycling unit .
1236 ! Merged w i t h t h e T r a n s p o r t L e n g h t s u b r o u t i n e s o t h i s one i s REDUNDANT.
1237 ! C a l c u l a t e s t h e t r a n s p o r t e d d i s t a n c e b a s e d on t h e pumped volume and c r o s s − s e c t i o n
1238 I m p l i c i t None
1239
1240 Integer :: i , j , Index_PD
1241 Real :: A_bh ! [ m2 ]
1242 Real , Allocatable : : TranspLen ( : ) ! [m]
1243 Real ( 8 ) , Allocatable : : TranspLenSum ( : ) ! [m]
1244 Integer :: TimeInt_PD ( : ) ! [s]
1245 Integer :: MudFlw ( : ) ! [ L / min ]
1246 Real , Allocatable : : PumpVol ( : ) ! [L]
1247 Real , Optional :: Loss
1248 Real :: Loss_P ! Loss p e r c e n t a g e
1249
1250 A l l o c a t e ( PumpVol ( Index_PD ) )
1251 A l l o c a t e ( T r a n s p L e n ( Index_PD ) )
1252 A l l o c a t e ( TranspLenSum ( Index_PD ) )
1253
1254 I f ( P r e s e n t ( L o s s ) ) Then
1255 Loss_P = L o s s
1256 Else
1257 Loss_P = 0 . 3 d0
1258 End I f
1259
1260 Do i =1 , Index_PD
1261 I f ( MudFlw ( i ) < 0 . o r . MudFlw ( i ) > 2 5 0 0 ) Then
1262 MudFlw ( i ) = 0
1263 End I f
1264
1265 PumpVol ( i ) = ( MudFlw ( i ) / 6 0 ) * TimeInt_PD ( i ) ! Mudflow i s g i v e n p e r m i n u t e s o i t
conversed to per second .
1266 PumpVol ( i ) = PumpVol ( i ) * ( 1 . d0 − Loss_P ) ! Correction for the i n f i l t r a t i o n loss .
1267 End Do
1268
1269 Do i = 1 , Index_PD
1270 T r a n s p L e n ( i ) = ( PumpVol ( i ) / 1 0 0 0 . d0 ) / ( A_bh )
1271 End Do
175

1272
1273 TranspLenSum ( Index_PD ) = T r a n s p L e n ( Index_PD )
1274 Do i = 1 , ( Index_PD − 1)
1275 j = Index_PD − i
1276 TranspLenSum ( j ) = TranspLenSum ( j + 1 ) + T r a n s p L e n ( j )
1277 End Do
1278
1279 End S u b r o u t i n e
1280
1281 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1282
1283 S u b r o u t i n e F l u i d V e l o c i t y ( AverageV , MaxV , Index_PD , Index_Sol_PD , MudFlw , A_bh , L o s s )
1284 ! Calculates the fluid velocity
1285 I m p l i c i t None
1286
1287 Real , Allocatable :: V( : ) ! [m/ s ]
1288 Integer :: CountN0Arr
1289 Real :: AverageV , MaxV
1290 Integer :: MudFlw ( : ) ! [ L / min ]
1291 Real :: A_bh ! [ m2 ]
1292 Real :: Loss
1293 Integer :: i , Index_Sol_PD , Index_PD
1294
1295
1296 A l l o c a t e (V( Index_PD − I n d e x _ S o l _ P D + 1 ) )
1297
1298 CountN0Arr = 0
1299
1300 Do i = index_Sol_PD , Index_PD
1301 V( i +1− I n d e x _ S o l _ P D ) = ( ( MudFlw ( i ) / 1 0 0 0 . d0 / 6 0 . d0 ) * ( 1 . d0 − L o s s ) ) / A_bh
1302 I f (V( i +1− I n d e x _ S o l _ P D ) > 0 ) CountN0Arr = CountN0Arr + 1
1303 End Do
1304
1305 AverageV = Sum (V) / CountN0Arr
1306 MaxV = Maxval (V)
1307
1308 Write ( * , * )
1309 W r i t e ( * , ’ ( 2 ( A, I ) ) ’ ) " Index_Sol_PD , Index_PD : " , I n d e x _ S o l _ P d , " , " , Index_PD
1310 W r i t e ( * , ’ ( 3 ( A, F5 . 2 ) ) ’ ) " AverageV , MaxV , MinV : " , AverageV , " , " ,MaxV , " , " , M i n v a l (V)
1311 Write ( * , * )
1312
1313 End S u b r o u t i n e
1314
1315 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1316
1317 S u b r o u t i n e I n t e r s e c t i o n ( DateTime_PD , Index_PD , DateTime_Sur , I n d e x _ S u r , TranspLenSum ,MD,
Index_Sol_PD , I n d e x _ S o l _ S u r , S o u r c e L o c _ S u r , SourceLoc_PD , SourceLocAv , DateTimeSample )
1318 ! F i n d s t h e v a l u e s from t h e P r o D a t a d a t a and d e r i v e d d a t a a t t h e t i m e s o f t h e S u r v e y f i l e .
1319 I m p l i c i t None
1320
1321 Integer :: h , i , j , k , l , z , Index_PD , I n d e x _ S u r
1322 Real ( 8 ) :: MD( : )
1323 Real ( 8 ) :: TranspLenSum ( : )
1324 Character (19) :: DateTime_PD ( : )
1325 Character (19) :: DateTime_Sur ( : )
1326 Integer :: Index_Sol_PD , I n d e x _ S o l _ S u r
1327 Real :: Deviation
1328 Real :: SourceLoc_PD , S o u r c e L o c _ S u r
1329 Real :: SourceLoc
1330 Character (19) :: DateTimeSample
1331 Real :: SourceLocAV , SourceLocAV1 , SourceLocAV2
1332 Integer (2) , Allocatable :: Day_Sur ( : ) , Month_Sur ( : ) , H o u r s _ S u r ( : ) , M i n u t e s _ S u r ( : ) , S e c o n d s _ S u r
(:)
1333 Integer (4) , Allocatable :: Year_Sur ( : )
1334 Integer (2) , Allocatable :: Day_PD ( : ) , Month_PD ( : ) , Hours_PD ( : ) , Minutes_PD ( : ) , Seconds_PD ( : )
1335 Integer (4) , Allocatable :: Year_PD ( : )
1336 Integer :: HH1 ,MM1, SS1 , HH2 ,MM2, SS2
1337
1338 C a l l D a t e T i m e I n t e g e r A r r a y ( DateTime_Sur , Day_Sur , Month_Sur , Year_Sur , Hours_Sur , M i n u t e s _ S u r ,
Seconds_Sur )
1339 C a l l D a t e T i m e I n t e g e r A r r a y ( DateTime_PD , Day_PD , Month_PD , Year_PD , Hours_PD , Minutes_PD , Seconds_PD )
176 E. Code of the SampleSource Program

1340
1341 ! Approach 1 − Making a l i s t o f I n d e x numbers c o n n e c t i n g t h e v a l u e s from t h e S u r f i l e t o
c e r t a i n v a l u e s from t h e PD D a t a and d e r i v e d v a l u e s .
1342
1343 ! A l l o c a t e ( IndexSurPD ( I n d e x _ S u r ) )
1344 !
1345 ! z =1
1346 ! Do i =1 , I n d e x _ S u r
1347 ! Do j =1 , Index_PD
1348 ! I f ( Day_Sur ( i ) == Day_PD ( j ) . and . Month_Sur ( i ) == Month_PD ( j ) . and . Y e a r _ S u r ( i ) ==
Year_PD ( j ) . and . H o u r s _ S u r ( i ) == Hours_PD ( j ) . and . M i n u t e s _ S u r ( i ) == Minutes_PD ( j ) ) Then
1349 ! I f ( S e c o n d s _ S u r ( i ) == Seconds_PD ( j ) . o r . ( S e c o n d s _ S u r ( i ) + 1 ) == Seconds_PD ( j ) . o r
. ( S e c o n d s _ S u r ( i ) + 2 ) == Seconds_PD ( j ) ) Then
1350 ! ! IndexSurPD ( i ) = j ! R e s u l t s i n IndexSurPD = 0 , a l l e n t r i e s
1351 ! ! or
1352 ! IndexSurPD ( z ) = j ! R e s u l t s i n IndexSurPD = − 116300599 , a l l e n t r i e s .
IndexSurPD ( z ) = z f o r some r e a s o n g i v e s t h e same r e s u l t . . .
1353 ! z=z +1
1354 ! W r i t e ( * , * ) IndexSurPD ( z ) , i , j , Day_Sur ( i ) , Day_PD ( j ) , M i n u t e s _ S u r ( i ) ,
Minutes_PD ( j ) , S e c o n d s _ S u r ( i ) , Seconds_PD ( j )
1355 ! End I f
1356 ! End I f
1357 ! End Do
1358 ! End Do
1359
1360 ! Approach 3 − ( Approach 2 was f a i r l y s i m i l a i r b u t b a s e d on i n t e r p o l a t i o n t o r e f i n e t h e
s o u r c e l o c a t i o n . a p p r o a c h 3 t a k e s t h e a v e r a g e o f t h e 2 s o l u t i o n s f o u n d . See comments . )
1361
1362 Write ( * , * ) ! I n s e r t s an empty l i n e f o r e a s i e r r e a d i n g
1363 D e v i a t i o n = 0 . 1 d0
1364 Do h =1 ,999 ! D e v i a t i o n l o o p , i f e x a c t match i s f o u n d s o l u t i o n i t won ’ t
be u s e d
1365 Do i =1 , I n d e x _ S u r ! S u r v e y b a s e d l o o p , c h a n g e s t h e s u r v e y t i m e and d a t e t o
t h e n e x t v a l u e i s no s o l u t i o n i s f o u n d
1366 k = I n d e x _ S u r +1− i
1367 Do j =1 , Index_PD ! P r o d a t a loop , l o o k e s t o a l l t h e P r o d a t a d a t a t o f i n d t h e
same v a l u e a t t h e g i v e n S u r v e y t i m e .
1368 l = Index_PD+1− i
1369 I f ( Day_Sur ( k ) == Day_PD ( j ) . and . Month_Sur ( k ) == Month_PD ( j ) . and . Y e a r _ S u r ( k )
== Year_PD ( j ) . and . H o u r s _ S u r ( k ) == Hours_PD ( j ) . and . M i n u t e s _ S u r ( k ) == Minutes_PD ( j ) )
Then
1370 I f (MD( k ) == TranspLenSum ( j ) ) Then
1371 W r i t e ( * , ’ (A, i , A, i ) ’ ) " S o l u t i o n f o u n d a t : " , k , " & " , j
1372 Index_Sol_Sur = k
1373 Index_Sol_PD = j
1374 W r i t e ( * , ’ (A, I , F8 . 2 ) ’ ) " I n d e x _ S o l _ S u r = " , I n d e x _ S o l _ S u r , MD( k )
1375 W r i t e ( * , ’ (A, I , F8 . 2 ) ’ ) " I n d e x _ S o l _ P D = " , Index_Sol_PD , TranspLenSum ( j )
1376 Return
1377 E l s e I f (MD( k ) <= ( TranspLenSum ( j ) * ( 1 + D e v i a t i o n / 1 0 0 ) ) . and . MD( k ) >= (
TranspLenSum ( j ) * (1 − D e v i a t i o n / 1 0 0 ) ) ) Then
1378 W r i t e ( * , ’ (A, I7 , A, I 7 ) ’ ) " A p p r o x i m a t e s o l u t i o n f o u n d a t : " , i , " & " , j
1379 Index_Sol_Sur = k
1380 Index_Sol_PD = j
1381 SourceLoc_Sur = MD( k )
1382 SourceLoc_PD = TranspLenSum ( j )
1383 W r i t e ( * , ’ (A, I7 , A, A, A, F7 . 2 ) ’ ) " I n d e x _ S o l _ S u r , DateTime , MD
= " , Index_Sol_Sur , " , " , DateTime_Sur ( k ) , " , " , SourceLoc_Sur
1384 W r i t e ( * , ’ (A, I7 , A, A, A, F7 . 2 ) ’ ) " Index_Sol_PD , DateTime , TranspLenSum
= " , Index_Sol_PD , " , " , DateTime_PD ( j ) , " , " , SourceLoc_PD
1385 W r i t e ( * , ’ (A, F5 . 1 ,A) ’ ) " Minimum D e v i a t i o n
= " , D e v i a t i o n , "%"
1386
1387 I f ( S o u r c e L o c _ S u r > SourceLoc_PD ) Then
1388 SourceLocAv = (MD( k ) + MD( k − 1) ) / 2
1389 W r i t e ( * , ’ (A, F ) ’ ) " SourceLoc = " , SourceLocAv
1390 E l s e I f ( S o u r c e L o c _ S u r < SourceLoc_PD ) Then
1391 SourceLocAv = (MD( k ) + MD( k + 1 ) ) / 2
1392 W r i t e ( * , ’ (A, F ) ’ ) " SourceLoc = " , SourceLocAv
1393 End I f
1394
1395 I f ( D e v i a t i o n <= 1 ) Then
177

1396 SourceLoc = MD( k )


1397 E l s e I f ( D e v i a t i o n > 1 ) Then ! P i c k one o f t h e two m e t h o d s .
1398 SourceLocAv1 = Abs ( (MD( k ) − TranspLenSum ( j ) ) / 2 ) +Min (MD( k ) ,
TranspLenSum ( j ) ) ! Always c a l c u l a t e o n l y s p e c i f i c l y m e n t i o n i t when d e v i a t i o n >= 5%
1399 W r i t e ( * , ’ (A, F8 . 3 ) ’ ) " SourceLocAv1 = " , SourceLocAv1
1400 SourceLocAv2 = (MD( k ) + MD( k + 1 ) ) / 2
1401 W r i t e ( * , ’ (A, F8 . 3 ) ’ ) " SourceLocAv2 = " , SourceLocAv2
1402 End I f
1403
1404 W r i t e ( * , ’ (A, F7 . 2 ) ’ ) "A more a c c u r a t e s o u r c e l o c a t i o n [m ] : " , SourceLocAv
1405 W r i t e ( * , ’ (A) ’ ) " Which i s t h e a v e r a g e o f t h e two . "
1406
1407 Return
1408 End I f
1409 End I f
1410 End Do
1411 End Do
1412 D e v i a t i o n = D e v i a t i o n + 0 . 1 d0 ! I n c r e a s e s t h e a l l o w e d D e v i a t i o n v a l u e by 0 . 1 , t h u s
a l l o w i n g a l e s s a c c u r a t e v a l u e t o be f o u n d i f no s o l u t i o n h a s b e e n f o u n d . Maximum
d e v i a t i o n o f an e x a c t match o f 0 . 1 + 9 9 9 * 0 . 1 = 1 0 0 . 0 % .
1413 End Do
1414
1415 W r i t e ( * , ’ (A, F5 . 1 ,A) ’ ) "A s o l u t i o n i s n o t f o u n d w i t h g i v e n maximum d e v i a t i o n , " , D e v i a t i o n , "%"
! I f n o t h i n g i s f o u n d f o r maximum D e v i a t i o n , i t d i s p l a y s t h a t i n f o r m a t i o n
1416 Index_Sol_PD = 1
1417 Index_Sol_Sur = 1
1418
1419 End S u b r o u t i n e
1420
1421 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1422
1423 S u b r o u t i n e S a m p l i n g L o c a t i o n ( I n d e x , E l e v a t i o n C a l c , Away , R_Calc , S a m p l i n g D e p t h , SamplingAway ,
SamplingRight )
1424 ! C a l c u l a t e s the l o c a t i o n at sampling time .
1425 I m p l i c i t None
1426
1427 Real :: E l e v a t i o n C a l c ( : ) , R_Calc ( : )
1428 Real ( 8 ) :: Away ( : )
1429 Integer :: Index
1430 Real :: S a m p l i n g D e p t h , SamplingAway , S a m p l i n g R i g h t
1431
1432 SamplingDepth = ElevationCalc ( Index )
1433 SamplingAway = Away ( I n d e x )
1434 SamplingRight = R_Calc ( I n d e x )
1435
1436 End S u b r o u t i n e
1437
1438 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1439
1440 S u b r o u t i n e S o u r c e L o c a t i o n ( I n d e x , SourceLocAv , MD, E l e v a t i o n C a l c , Away , R_Calc , S o u r c e D e p t h ,
SourceAway , S o u r c e R i g h t )
1441 ! C a l c u l a t e s t h e s o u r c e l o c a t i o n b a s e d on t h e i n t e r s e c t i o n f o u n d i n t h e i n t e r s e c t i o n
s u b r o u t i n e and by i n t e r p o l a t i o n w i t h i n t h e s u r v e y d a t a .
1442 I m p l i c i t None
1443
1444 Real :: E l e v a t i o n C a l c ( : ) , R_Calc ( : )
1445 Real ( 8 ) :: Away ( : ) , MD( : )
1446 Integer :: Index
1447 Real :: S o u r c e D e p t h , SourceAway , S o u r c e R i g h t
1448 Real :: SourceLocAv
1449
1450 Real :: c1 , c2
1451
1452 I f ( SourceLocAv < MD( I n d e x ) ) Then
1453 Write ( * , * )
1454 W r i t e ( * , ’ (A) ’ ) " SourceLocAv < MD"
1455
1456 c1 = a b s ( SourceLocAv − MD( I n d e x ) ) / a b s (MD( I n d e x ) − MD( I n d e x − 1) )
1457 c2 = a b s ( SourceLocAv − MD( I n d e x − 1) ) / a b s (MD( I n d e x ) − MD( I n d e x − 1) )
1458
1459 W r i t e ( * , ’ (A, F8 . 3 , F8 . 3 ) ’ ) " c1 and c2 : " , c1 , c2
178 E. Code of the SampleSource Program

1460
1461 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) " E l e v a t i o n C a l c ( I n d e x ) & E l e v a t i o n C a l c ( I n d e x − 1) :
" , E l e v a t i o n C a l c ( I n d e x ) , " , " , E l e v a t i o n C a l c ( I n d e x − 1)
1462 SourceDepth = c1 * E l e v a t i o n C a l c ( I n d e x − 1) + c2 * E l e v a t i o n C a l c ( I n d e x )
1463 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) "Away ( I n d e x ) & Away ( I n d e x − 1) :
" , Away ( I n d e x ) , " , " , Away ( I n d e x − 1)
1464 SourceAway = c1 * Away ( I n d e x − 1) + c2 * Away ( I n d e x )
1465 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) " R_Calc ( I n d e x ) & R_Calc ( I n d e x − 1) :
" , R_Calc ( I n d e x ) , " , " , R_Calc ( I n d e x − 1)
1466 SourceRight = c1 * R_Calc ( I n d e x − 1) + c2 * R_Calc ( I n d e x )
1467
1468 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 , A, F8 . 3 ) ’ ) " S o u r c e D e p t h , SourceAway , S o u r c e R i g h t :
" , S o u r c e D e p t h , " , " , SourceAway , " , " , S o u r c e R i g h t
1469 Write ( * , * )
1470
1471 E l s e I f ( SourceLocAv > MD( I n d e x ) ) Then
1472 Write ( * , * )
1473 W r i t e ( * , ’ (A) ’ ) " SourceLocAv > MD"
1474
1475 c1 = a b s ( SourceLocAv − MD( I n d e x ) ) / a b s (MD( I n d e x ) − MD( I n d e x + 1 ) )
1476 c2 = a b s ( SourceLocAv − MD( I n d e x + 1 ) ) / a b s (MD( I n d e x ) − MD( I n d e x + 1 ) )
1477
1478 W r i t e ( * , ’ (A, F8 . 3 , F8 . 3 ) ’ ) " c1 and c2 : " , c1 , c2
1479
1480 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) " E l e v a t i o n C a l c ( I n d e x ) & E l e v a t i o n C a l c ( I n d e x − 1) :
" , E l e v a t i o n C a l c ( I n d e x ) , " , " , E l e v a t i o n C a l c ( I n d e x − 1)
1481 SourceDepth = c1 * E l e v a t i o n C a l c ( I n d e x − 1) + c2 * E l e v a t i o n C a l c ( I n d e x )
1482 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) "Away ( I n d e x ) & Away ( I n d e x − 1) :
" , Away ( I n d e x ) , " , " , Away ( I n d e x − 1)
1483 SourceAway = c1 * Away ( I n d e x − 1) + c2 * Away ( I n d e x )
1484 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 ) ’ ) " R_Calc ( I n d e x ) & R_Calc ( I n d e x − 1) :
" , R_Calc ( I n d e x ) , " , " , R_Calc ( I n d e x − 1)
1485 SourceRight = c1 * R_Calc ( I n d e x − 1) + c2 * R_Calc ( I n d e x )
1486
1487 W r i t e ( * , ’ (A, F8 . 3 , A, F8 . 3 , A, F8 . 3 ) ’ ) " S o u r c e D e p t h , SourceAway , S o u r c e R i g h t :
" , S o u r c e D e p t h , " , " , SourceAway , " , " , S o u r c e R i g h t
1488 Write ( * , * )
1489
1490 E l s e I f ( SourceLocAv == MD( I n d e x ) ) Then
1491 Write ( * , * )
1492 W r i t e ( * , ’ (A) ’ ) " SourceLocAv == MD"
1493
1494 SourceDepth = ElevationCalc ( Index )
1495 SourceAway = Away ( I n d e x )
1496 SourceRight = R_Calc ( I n d e x )
1497
1498 W r i t e ( * , ’ (A, F8 . 3 , F8 . 3 , F8 . 3 ) ’ ) " S o u r c e D e p t h , SourceAway , S o u r c e R i g h t : " , S o u r c e D e p t h ,
SourceAway , S o u r c e R i g h t
1499 Write ( * , * )
1500
1501 End I f
1502
1503 End S u b r o u t i n e
1504
1505 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1506
1507 S u b r o u t i n e T r a n s p o r t T i m e s ( DateTime_PD , DateTime_Sur , Index_Sol_PD , I n d e x _ S o l _ S u r , DateTimeSample ,
T i m e I n t 1 , T i m e I n t 2 , TimeIntAv )
1508 ! C a l c u l a t e s t r a n s p o r t t i m e b u t a l s o pumptimes d u r i n g t h e t r a n s p o r t i n t e r v a l , which c a n be
used as the d r i l l time during the t r a n s p o r t i n t e r v a l .
1509 ! Made s e p a r a t e t o c l e a n t h e i n t e r s e c t i o n s u b r o u t i n e .
1510 I m p l i c i t None
1511
1512 Character (19) :: DateTimeSample
1513 Integer :: TimeInt1 , TimeInt2
1514 Integer :: TimeIntAv
1515 Character (19) :: DateTime_PD ( : )
1516 Character (19) :: DateTime_Sur ( : )
1517 Integer :: Index_Sol_PD , I n d e x _ S o l _ S u r
1518 Integer :: HH1 ,MM1, SS1 , HH2 ,MM2, SS2 , HH3 ,MM3, SS3
1519
179

1520 C a l l T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t 1 , D a t e T i m e _ S u r ( I n d e x _ S o l _ S u r ) , DateTimeSample )
1521 C a l l T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t 2 , DateTime_PD ( I n d e x _ S o l _ P D ) , DateTimeSample )
1522
1523 I f ( T i m e I n t 1 >= ( 1 2 * 60 * 6 0 ) ) Then ! S t a b i l i t y measure , a c c o u n t i n g f o r t h e s t o p d u r i n g t h e
night .
1524 T i m e I n t 1 = T i m e I n t 1 − ( 1 2 * 60 * 6 0 )
1525 End I f
1526
1527 I f ( T i m e I n t 2 >= ( 1 2 * 60 * 6 0 ) ) Then
1528 T i m e I n t 2 = T i m e I n t 2 − ( 1 2 * 60 * 6 0 )
1529 End I f
1530
1531 C a l l SecToTimeI ( T i m e I n t 1 , HH1 ,MM1, SS1 )
1532 C a l l SecToTimeI ( T i m e I n t 2 , HH2 ,MM2, SS2 )
1533
1534 W r i t e ( * , ’ (A, I6 , A, I 2 . 2 , A, I 2 . 2 , A, I 2 . 2 ,A) ’ ) " T r a n s p o r t time i s between " , TimeInt1 , " or " ,
HH1 , " : " ,MM1, " : " , SS1 , " and "
1535 W r i t e ( * , ’ (A, I6 , A, I 2 . 2 , A, I 2 . 2 , A, I 2 . 2 ) ’ ) " " , TimeInt2 , " or " ,
HH2 , " : " ,MM2, " : " , SS2
1536
1537 TimeIntAv = ( ( T i m e I n t 1 + T i m e I n t 2 ) * 0 . 5 )
1538 C a l l SecToTimeI ( TimeIntAv , HH3 ,MM3, SS3 )
1539
1540 W r i t e ( * , ’ (A, I6 , A, I 2 . 2 , A, I 2 . 2 , A, I 2 . 2 ) ’ ) " Average t r a n s p o r t time i s " , TimeIntAv , " o r " ,
HH3 , " : " ,MM3, " : " , SS3
1541
1542 End S u b r o u t i n e T r a n s p o r t T i m e s
1543
1544 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1545
1546 S u b r o u t i n e PumpTimes ( MudFlw , TimeInt_PD , Index_Sol_PD , Index_PD , PumpTime )
1547 ! C a l c u l a t e s pump t i m e d u r i n g t h e t r a n s p o r t i n t e r v a l , which c a n be u s e d a s t h e d r i l l t i m e
during the t r a n s p o r t i n t e r v a l .
1548 ! Made s e p a r a t e t o c l e a n t h e i n t e r s e c t i o n s u b r o u t i n e .
1549 I m p l i c i t None
1550
1551 Integer :: i , Index_Sol_PD , Index_PD
1552 Integer :: TimeInt_PD ( : ) ! [s]
1553 Integer :: MudFlw ( : ) ! [ L / min ]
1554 Integer :: PumpTime
1555 Integer :: HH1 ,MM1, SS1 , HH2 ,MM2, SS2
1556
1557 PumpTime = 0
1558
1559 Do i = I n d e x _ S o l _ P D +1 , Index_PD
1560 I f ( MudFlw ( i ) > 0 ) Then
1561 PumpTime = PumpTime + TimeInt_PD ( i )
1562 End I f
1563 End Do
1564
1565 C a l l SecToTimeI ( PumpTime , HH1 ,MM1, SS1 )
1566
1567 W r i t e ( * , ’ (A, I6 , A, I 2 . 2 , A, I 2 . 2 , A, I 2 . 2 ) ’ ) " Pump t i m e i s " , PumpTime , " o r " ,
HH1 , " : " ,MM1, " : " , SS1
1568
1569 End S u b r o u t i n e PumpTimes
1570
1571 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1572 ! Fluid Properties
1573 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1574
1575 S u b r o u t i n e D m a x T r a n s p o r t ( Y_g , T a u _ Y i e l d , Rho_Inflow , Rho_Grain , g , D90 , F l u i d T y p e )
1576 ! C a l c u l a t e s t h e T r a n s p o r t p a r a m e t e r a s f o u n d i n Denekamp , 2 0 0 0 . 0.1 < i s a p r o b l e m and i d e a l
i s >2 o r 4 .
1577 I m p l i c i t None
1578 Real : : Y_g
1579 Real :: Tau_Yield
1580 Real :: Rho_Inflow , Rho_Grain
1581 Real : : D90
1582 Real :: g
1583 Character (2) :: FluidType
180 E. Code of the SampleSource Program

1584 Character (1024) : : Message


1585 Integer :: SampleLog =25
1586
1587 D90 = ( 3 * T a u _ Y i e l d ) / ( ( Rho_Grain − R h o _ I n f l o w ) * g * Y_g )
1588
1589 W r i t e ( Message , ’ (A, F , A, F3 . 1 ,A) ’ ) " The max d i a m e t e r f o r a " / / F l u i d T y p e / / " f l u i d i s " , D90 , "
mm w h i l e Yg i s " , Y_g , " . "
1590 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , SampleLog )
1591
1592 End S u b r o u t i n e
1593
1594 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1595
1596 S u b r o u t i n e MaxDiameterSusp ( D_max , v , g , D_Hole , Rho_Grain , Rho_Bf , C o n c _ G r a i n s )
1597 ! C a l c u l a t e s t h e maximum d i a m e t e r f o r s u s p e n s i o n t r a n s p o r t
1598 ! Based on Denekamp , 2 0 0 0 ( 3 1 ) ? ? ?
1599 ! R e w r i t t e n f o r m u l a , d e r i v e d i n ( Hanks , 1 9 8 0 ) a s f o u n d i n ( B i s s c h o p , 1 9 9 5 ) .
1600 ! Assumed i s t h a t t h e volume c o n c e n t r a t i o n g r a i n s i n d r i l l i n g f l u i d i s t h e same a s t h e s a n d
content .
1601 I m p l i c i t None
1602
1603 Real :: D_max ! [m] , maximum d i a m e t e r i n s u s p e n s i o n .
1604 Real :: v ! [m/ s ] , f l u i d v e l o c i t y b a s e d on p l u g f l o w
1605 Real :: c1 , c2 , c3 , c4 , c5 ! A number o f c o n s t a n t s
1606 Real :: g ! [m/ s ^ 2 ]
1607 Real :: D_Hole ! [m] , d i a m e t e r h o l e
1608 Real :: Rho_Grain , Rho_Bf ! [ kg / m3 ] , d e n s i t y o f t h e g r a i n s and t h e b o r e f l u i d
1609 Real :: Conc_Grains ! [ −]
1610 Character (1024) :: Message
1611 Integer : : SampleLog =25
1612
1613 c1 = 1 . 3 2 d0
1614 c2 = 0 . 1 8 6 d0
1615 c3 = 2 . 0 d0
1616 c4 = 0 . 5 d0
1617 c5 = 0 . 2 3 d0
1618
1619 Rho_Bf = 1 0 0 0 . d0 * Rho_Bf ! C o n v e r t t o [ kg /m^ 3 ]
1620
1621 W r i t e ( * , ’ (A, F ) ’) "V :" ,v
1622 W r i t e ( * , ’ (A, F ) ’) " D_Hole :" , D_Hole
1623 W r i t e ( * , ’ (A, F ) ’) " Rho_Grain :" , Rho_Grain
1624 W r i t e ( * , ’ (A, F ) ’) " Rho_Bf :" , Rho_Bf
1625 W r i t e ( * , ’ (A, F ) ’) " Conc_Grains :" , Conc_Grains
1626
1627 D_max = D_Hole * ( ( v * ( c3 * g * D_Hole * ( ( Rho_Grain − Rho_Bf ) / Rho_Bf ) ) * * ( − c4 ) ) / ( c1 * C o n c _ G r a i n s * *
c2 ) ) * * ( 1 / c5 )
1628
1629 W r i t e ( Message , ’ (A, F , A) ’ ) " The maximum d i a m e t e r f o r s u s p e n s i o n t r a n s p o r t i s " , D_max , " . "
1630 C a l l W r i t e L o g ( 1 , t r i m ( Message ) , SampleLog )
1631
1632 End S u b r o u t i n e
1633
1634 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1635
1636 S u b r o u t i n e M u d P r e s s u r e ( L o c a t i o n , DateTimeSample , AP , A c t i v i t y , J o i n t N o , Joint_MP , Mud_P )
1637 ! Reads t h e a n n u l a i r mud p r e s s u r e
1638 I m p l i c i t None
1639
1640 Character (19) :: DateTimeSample
1641 Integer :: AP ( : )
1642 Integer :: Mud_P
1643 Integer :: i
1644 Character (3) :: Activity (:)
1645 Character (3) :: ActivityKey
1646 Integer (2) :: Day_MP , Month_MP
1647 Integer :: Joint_MP ( : )
1648 Integer :: JointNo
1649 Character (*) :: Location
1650
1651 C a l l D a t e T i m e I n t e g e r S i n g l e B a s i c ( DateTimeSample , Day_MP , Month_MP )
181

1652
1653 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) Then
1654 I f ( Day_MP <= 11 . and . Month_MP == 9 ) Then
1655 ActivityKey = ’ 85 J ’
1656 E l s e I f ( Day_MP >= 12 . and . Day_MP <= 21 . and . Month_MP == 9 ) Then
1657 ActivityKey = ’ 85M’
1658 E l s e I f ( Day_MP >= 22 . and . Month_MP == 9 ) Then
1659 ActivityKey = ’ 65 J ’
1660 End I f
1661 E l s e I f ( L o c a t i o n == ’ T e x e l ’ ) Then
1662 I f ( Day_MP <= 27 . and . Month_MP == 7 ) Then
1663 ActivityKey = ’ 65m’
1664 E l s e I f ( Day_MP >= 28 . and . Month_MP == 7 ) Then
1665 ActivityKey = ’ 85m’
1666 E l s e I f ( Month_MP == 8 ) Then
1667 ActivityKey = ’ 85m’
1668 End I f
1669 End I f
1670
1671 Do i = 1 , s i z e ( A c t i v i t y )
1672 I f ( A c t i v i t y ( i ) == A c t i v i t y K e y . and . J o i n t N o == J o i n t _ M P ( i ) ) Then
1673 Mud_P = AP ( i )
1674 ! W r i t e ( * , * ) A c t i v i t y K e y , i , A c t i v i t y ( i ) , J o i n t N o , J o i n t _ M P ( i ) , Mud_P
1675 End I f
1676 End Do
1677
1678 End S u b r o u t i n e
1679
1680 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1681
1682 S u b r o u t i n e MaxPlugRadius ( Tau_Y , L , DP , MaxPlugR )
1683 ! C a l c u l a t e s t h e maximum p l u g f l o w r a d i u s i n p i p e s K e l e s s i d i s , 2 0 0 6
1684 I m p l i c i t None
1685
1686 Real :: MaxPlugR
1687 Real :: Tau_Y , DP ! DP i s i n [ kPa ]
1688 Real ( 8 ) :: L
1689
1690 MaxPlugR = 2 . d0 * Tau_Y * ( L / ( DP * 1 0 0 0 . d0 ) ) ! F a c t o r 1000 c h a n g e s t h e u n i t from [
kPa ] t o [ Pa ] which i s t h e same a s t h e Tau_Y .
1691
1692 W r i t e ( * , ’ (A, F5 . 3 ,A) ’ ) "Max P l u g Flow R a d i u s : " , MaxPlugR , " m. "
1693
1694 End S u b r o u t i n e
1695
1696 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1697
1698 S u b r o u t i n e MaxPlugRadius2 ( Tau_Y , L , DP2 , MaxPlugR , D_bh , D_ds )
1699 ! C a l c u l a t e s t h e maximum p l u g f l o w r a d i u s i n p i p e s K e l e s s i d i s , 2 0 0 6
1700 I m p l i c i t None
1701
1702 Real :: MaxPlugR
1703 Real :: Tau_Y , DP2 ! DP i s i n [ kPa ]
1704 Real ( 8 ) :: L
1705 Real :: ya , yb
1706 Real :: h
1707 Real :: D_bh , D_ds
1708
1709 h = ( D_bh − D_ds ) / 2 . d0
1710
1711 ya = ( h / 2 . d0 ) − ( Tau_Y / ( ( DP2 * 1 0 0 0 . d0 ) / L ) )
1712 yb = ( h / 2 . d0 ) + ( Tau_Y / ( ( DP2 * 1 0 0 0 . d0 ) / L ) )
1713
1714 MaxPlugR = yb − ya
1715
1716 W r i t e ( * , ’ (A, F5 . 3 ,A) ’ ) "Max P l u g Flow R a d i u s 2 : " , MaxPlugR , " m. "
1717
1718 End S u b r o u t i n e
1719
1720 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1721
182 E. Code of the SampleSource Program

1722 S u b r o u t i n e I n f i l t r a t i o n L o s s B T L ( L o c a t i o n , g , Loss , Depth , T a u _ Y i e l d , D15 , D_bh , Mud_P , P i )


1723 ! C a l c u l a t e s t h e i n f i l t r a t i o n l o s s b a s e d on Denekamp , 2 0 0 0 .
1724 I m p l i c i t None
1725
1726 Real : : Alpha , Kappa ! Constants
1727 Real : : D15 , D_bh
1728 Real : : y_a , y_c
1729 Real ( 8 ) : : pi
1730 Real : : Mud_P ! [ kPa ]
1731 Real : : n0 ! [ −]
1732 Real :: Loss ! [ m3 / s ]
1733 Real :: Depth ! [m NAP]
1734 Real : : dp ! [ Pa ]
1735 Real :: Tau_Yield ! [ Pa ]
1736 Real :: D_pores ! [m]
1737 Real :: V_drill ! [m/ s ]
1738 Real :: g
1739 Character (*) :: Location
1740
1741 Alpha = 0 . 1 1 d0 ! [ −] 8 / 7 5
1742 Kappa = 2 . d0 ! [ −]
1743 n0 = 0 . 4 d0 ! [ −]
1744 D_pores = 0 . 4 4 d0 * D15 ! [m] 4 / 9
1745 y_c = 0 . 0 0 2 d0 ! [m] , a s t a n d a r d v a l u e by c e b o i s 2 mm. no f o r m u l a f o r t h i s i s
f o u n d i n Denekamp , 2 0 0 0 .
1746
1747 Write ( * , * )
1748 W r i t e ( * , ’ (A, F , F ) ’ ) " Mud_P , Depth : " , Mud_P , Depth
1749
1750 I f ( L o c a t i o n == ’ T e x e l ’ ) dp = Mud_P * 1 0 0 0 . d0 − ( ( − 1 . d0 * ( Depth − − 0.18 d0 ) ) * g * 1 0 0 0 .
d0 ) ! I n V o o r o n t w e r p r a p p o r t a v e r a g e − 0.18 and + 0 . 3 8 mNAP w a t e r l e v e l f o r T e x e l and
Den H e l d e r .
1751 I f ( L o c a t i o n == ’ Den H e l d e r ’ ) dp = Mud_P * 1 0 0 0 . d0 − ( ( − 1 . d0 * ( Depth − 0.38 d0 ) ) * g * 1 0 0 0 . d0
)
1752
1753 W r i t e ( * , ’ (A) ’ ) " dp , Alpha , D_Pores , D15 : "
1754 W r i t e ( * , ’ ( F , A, F , A, F , A, F ) ’ ) dp , " , " , Alpha , " , " , D_Pores , " , " , D15
1755
1756 W r i t e ( * , ’ ( 2 ( A, F ) ) ’ ) " Kappa , T a u _ Y i e l d : " , Kappa , " , " , T a u _ Y i e l d
1757
1758 y_a = ( dp * Alpha * D_Pores ) / ( Kappa * T a u _ Y i e l d )
1759
1760 W r i t e ( * , ’ (A, F ) ’ ) " y_a : " , y_a
1761
1762 I f ( L o c a t i o n == ’ T e x e l ’ ) v _ d r i l l = 0 . 7 5 d0 / 6 0 . d0 ! Based on d o t g r a p h f o u n d i n
i n t e r p r e t a t i o n r e p o r t , which i s i n [m/ min ]
1763 I f ( l o c a t i o n == ’ Den H e l d e r ’ ) v _ d r i l l = 1 . 1 d0 / 6 0 . d0 ! S i n c e [m/ s ] i s r e q u i r e d i t i s
d i v i d e d by 6 0 . d0 .
1764
1765 L o s s = P I * v _ d r i l l * ( n0 * ( D_bh * y_a + y_a * * 2 ) + y_c * ( D_bh − y_c ) )
1766
1767 End S u b r o u t i n e
1768
1769 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1770 ! Plotting the data
1771 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1772
1773 S u b r o u t i n e f 2 g p ( ID , n1 , n2 , n3 , x d a t a 1 , y d a t a 1 , s t y l e 1 , x d a t a 2 , y d a t a 2 , s t y l e 2 , p l o t _ t y p e , x l a b e l , y l a b e l
, title1 , title2 , scenario )
1774 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
1775 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
1776 ! A d a p t e d t o my p u r p o s e s , a . o . d a t e t i m e a x i s .
1777 ! P l o t s t h e away v e r s u s t h e t r a n s p o r t e d l e n g t h . I n t h e m a i n l o o p s i n c e i t c o n t a i n s t h e
r e s u l t s of 1 sample .
1778 ! M u l t i p l o t p a r t i s b a s e d on h t t p : / / o n t u b l o g . b l o g s p o t . n l / 2 0 0 9 / 1 0 / p l o t s − i n s i d e − o t h e r − p l o t s −
w i t h − g n u p l o t . h t m l & h t t p : / / www. g n u p l o t t i n g . o r g / zooming − i n − w i t h − m u l t i p l o t /
1779 I m p l i c i t None
1780
183

1781 Character (*) , Parameter :: filefolderScenarios_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \


ProgramOutput \ S c e n a r i o s \ "
1782 Character (*) : : ID ! Sample ID . , u s e d f o r
t i t l e o f g r a p h and g r a p h f i l e n a m e .
1783 Integer : : n1 , n2 ! number o f d a t a p o i n t s
1784 Integer : : n3 ! index of i n t e r s e c t i o n of
t h e PD d a t a
1785 Character (19) :: xdata1 ( : ) ! f i r s t x data array
1786 Character (19) :: DateTimeSource
1787 Character (19) :: DateTimeSample
1788 Character (19) : : DateTimeMin
1789 Character (19) : : DateTimeMax
1790 Real ( 8 ) :: ydata1 ( : ) ! f i r s t y data array
1791 Character (19) :: xdata2 ( : ) ! second x data a r r a y
1792 Real ( 8 ) :: ydata2 ( : ) ! second y data a r r a y
1793 Integer :: plot_type ! 1 for l i n e a r plot , 2 for
l o g p l o t , 3 f o r log −l o g p l o t
1794 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e 1 , t i t l e 2 ! p l o t a x i s l a b e l s and
title
1795 Integer :: TimeInt
1796 Integer :: i , X, Y
1797 Integer :: TimeIntGP
1798 Integer (2) : : Day , Day_Min , Day_Max
1799 Integer (2) : : Month , Month_Min , Month_Max
1800 Integer (4) :: Year
1801 Integer (2) : : Hours , M i n u t e s , S e c o n d s
1802 Character (2) :: style1 , style2
1803 Character (25) :: Layout1 , L a y o u t 2
1804 Integer , optional :: Scenario
1805 Character (100) :: Filename
1806
1807 DateTimeSource = x d a t a 1 ( n3 )
1808 DateTimeSample = x d a t a 1 ( n1 )
1809
1810 X = 1 ! Amount o f d a y s t h a t w i l l be s u b s t r a c t e d from t h e s o u r c e d a t e t i m e and a d d e d t o
i t , i n o r d e r t o r e s p e c t i v e l y form t h e mimimum and maximum o f t h e zoomed p l o t
1811 ! C a l l ZoomGPDays ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , X)
1812 ! Or
1813 Y = 6 ! Amount o f h o u r s t h a t w i l l be s u b s t r a c t e d from t h e s o u r c e d a t e t i m e and a d d e d
t o i t , i n o r d e r t o r e s p e c t i v e l y form t h e mimimum and maximum o f t h e zoomed p l o t
1814 C a l l ZoomGPHours ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , Y)
1815
1816 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1817 ! W r i t e d a t a on two s e p a r a t e f i l e s
1818 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1819 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ ) ! ProData data
1820 Do i =1 , n1
1821 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
1822 End Do
1823 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
1824
1825 I f ( P r e s e n t ( S c e n a r i o ) ) Then
1826 W r i t e ( F i l e n a m e , ’ (A, A, I 2 . 2 ,A) ’ ) t r i m ( ID ) , ’ PumpedVol S c e n a r i o ’ , S c e n a r i o , ’ . t x t ’
1827 Open ( 1 1 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = f i l e f o l d e r S c e n a r i o s _ o u t / / t r i m ( F i l e n a m e ) )
1828 Do i =1 , n1
1829 W r i t e ( 1 1 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
1830 End Do
1831 C l o s e ( 1 1 , S t a t u s = ’ Keep ’ )
1832 End I f
1833
1834 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ ) ! Survey Data
1835 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( 1 ) , y d a t a 2 ( 1 ) ! Required for i f loop
1836 Do i =2 , n2
1837 C a l l T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t , x d a t a 2 ( i ) , x d a t a 2 ( i − 1) )
1838 I f ( T i m e I n t >= ( 2 4 * 60 * 6 0 ) ) Then ! C r e a t e s g a p s i n t h e d a t a which w i l l c a u s e t h e
l i n e t o be b r o k e n i n t h e g r a p h .
1839 Write (10 , * ) ! Gaps a r e p u t i n t h e d a t a f i l e i f t h e t i m e b e t w e e n
two p o i n t s i s more t h a n 24 h r s , t h i s means t h a t t h e l i n e s w i l l c o n t i n u e f o r t h e
n i g h t s h i f t s t o p s b u t n o t f o r t h e s t o p t e s t and b e t w e e n d i f f e r e n t d r i l l i n g s .
1840 End I f
1841 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i )
184 E. Code of the SampleSource Program

1842 End Do
1843 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
1844
1845 I f ( P r e s e n t ( S c e n a r i o ) ) Then
1846 W r i t e ( F i l e n a m e , ’ (A, A, I 2 . 2 ,A) ’ ) t r i m ( ID ) , ’ Away S c e n a r i o ’ , S c e n a r i o , ’ . t x t ’
1847 Open ( 1 1 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = f i l e f o l d e r S c e n a r i o s _ o u t / / t r i m ( F i l e n a m e ) )
1848 W r i t e ( 1 1 , ’ ( A19 , F9 . 3 ) ’ ) x d a t a 2 ( 1 ) , y d a t a 2 ( 1 )
1849 Do i =2 , n2
1850 I f ( y d a t a 2 ( i ) < y d a t a 2 ( i − 1) ) Then
1851 Write (11 , * )
1852 End I f
1853 W r i t e ( 1 1 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i )
1854 End Do
1855 C l o s e ( 1 1 , S t a t u s = ’ Keep ’ )
1856 End I f
1857
1858 ! C r e a t e g n u p l o t command f i l e
1859 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1860 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1861 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create .
png
1862 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) t r i m ( ID ) / / ’ I n t e r s e c t i o n S c e n a r i o ’ , S c e n a r i o , ’ . png ’
1863 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / S a m p l e s / ’ / / t r i m (
filename ) / / ’" ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The
" / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
1864
1865 Write (10 , * ) ’ s e t xdata time ’
1866 W r i t e ( 1 0 , * ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
1867
1868 Write (10 , * ) ’ s e t m u l t i p l o t ’
1869
1870 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( f i l e n a m e ) / / ’ } " ’ ! Graph T i t l e , t i t l e i n b o l d
, works
1871 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes the
p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p .
F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
1872 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " ’
1873 W r i t e ( 1 0 , * ) ’ s e t y t i c s 500 ’
1874 Write (10 , * ) ’ s e t mytics 5 ’
1875
1876 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t b o t t o m box ’
1877
1878 W r i t e ( 1 0 , ’ (A, A, A, A, A) ’ ) ’ s e t x r a n g e [ " ’ , DateTimeMin , ’ " : " ’ , DateTimeMax , ’ " ] ’
1879 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
1880
1881 Write (10 , * ) ’ s e t g r i d mytics y t i c s x t i c s ’
1882
1883 C a l l GraphStyle ( Style1 , Layout1 )
1884
1885 C a l l GraphStyle ( Style2 , Layout2 )
1886
1887 I f ( p l o t _ t y p e ==2) W r i t e ( 1 0 , * ) ’ s e t l o g y ’ ! L o g a r i t h m i c s c a l e on t h e y − a x i s o n l y
1888 I f ( p l o t _ t y p e ==3) Then ! L o g a r i t h m i c s c a l e on b o t h a x i s .
1889 Write (10 , * ) ’ s e t log x ’
1890 Write (10 , * ) ’ s e t log y ’
1891 End I f
1892
1893 I f ( n1 > 0 .AND. n2 > 0 ) Then
1894 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / /
’ " , " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’ !
B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s t h e y − d a t a becomes column 3 .
1895 End I f
1896
1897 I f ( n1 > 0 .AND. n2 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / /
TRIM ( t i t l e 1 ) / / ’ " ’ ! I f one o f t h e a r r a y s i s empty o n l y one g r a p h w i l l be p l o t e d .
1898
1899 I f ( n2 > 0 .AND. n1 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / /
TRIM ( t i t l e 2 ) / / ’ " ’
1900
1901 ! Smaller plot
1902 Write (10 , * ) ’ s e t s i z e 0 . 3 , 0 . 3 ’
185

1903 Write (10 , * ) ’ s e t o r i g i n 0.65 ,0.55 ’


1904 Write (10 , * ) ’ s e t bmargin 3 ; s e t tmargin 3 ; s e t lmargin 6 ; s e t rmargin 2 ’ !
D e t e r m i n e s t h e s i z e o f t h e c a n v a s t h a t i s c l e a n e d a r o u n d t h e p l o t ( e x c l u d e s t h e t i t l e and
axis )
1905 Write (10 , * ) ’ c l e a r ’
1906 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / ’Zoom } " ’
1907
1908 Write (10 , * ) ’ s e t xdata time ’
1909 W r i t e ( 1 0 , * ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
1910
1911 write (10 , * ) ’ s e t xrange [ * : * ] ’
1912 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
1913
1914 Write (10 , * ) ’ s e t xlabel "" ’
1915 Write (10 , * ) ’ s e t ylabel "" ’
1916 Write (10 , * ) ’ s e t y t i c s 5000 ’
1917 Write (10 , * ) ’ unset mytics ’
1918
1919 W r i t e ( 1 0 , * ) ’ s e t key o f f ’
1920 Write (10 , * ) ’ unset g r i d ’
1921 Write (10 , * ) ’ s e t g r i d ’
1922
1923 ! And f i n a l l y l e t ’ s p l o t t h e same s e t o f d a t a , b u t i n t h e s m a l l e r p l o t
1924 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / / ’ " ,
" x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’
1925
1926 ! It ’ s important to close the m u l t i p l o t environment ! ! !
1927 Write (10 , * ) ’ unset m u l t i p l o t ’
1928
1929 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
1930
1931 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1932 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1933 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1934
1935 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
1936
1937 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1938 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
1939 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
1940
1941 ! Check m e s s a g e
1942 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1943 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / ID / / ’ I n t e r s e c t i o n . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1944
1945 End S u b r o u t i n e
1946
1947 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1948
1949 S u b r o u t i n e f2gp2 ( xdata1 , ydata1a , ydata1b , xdata2 , ydata2 , p l o t _ t y p e , filename , t i t l e , xl ab el , ylabel1
, ylabel2 , t i t l e 1 , t i t l e 2 , t i t l e 3 )
1950 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
1951 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
1952 ! A d a p t e d t o my p u r p o s e s , a . o . d a t e t i m e a x i s .
1953 ! P l o t s t h e l e n g h t v e r s u s t h e t r a n s p o r t and pump t i m e s . T h i s i s done o u t s i d e o f t h e
mainloop s i n c e i t c o n t a i n s the r e s u l t s of m u l t i p l e samples .
1954 I m p l i c i t None
1955
1956 Integer :: n1 , n2 ! number o f d a t a p o i n t s
1957 Character (19) :: xdata1 ( : ) ! f i r s t x data array
1958 Integer :: ydata1a ( : ) ! f i r s t y data array , a
TimeIntAvAll
1959 Integer :: ydata1b ( : ) ! f i r s t y data array , b
PumpTime
1960 Character (19) :: xdata2 ( : ) ! second x data a r r a y
1961 Real ( 8 ) :: ydata2 ( : ) ! second y data a r r a y
1962 Integer :: plot_type ! 1 for l i n e a r plot , 2 for log
186 E. Code of the SampleSource Program

plot , 3 for log −l o g p l o t


1963 Character (*) :: xlabel , ylabel1 , ylabel2 ! p l o t a x i s l a b e l s and t i t l e
1964 Character (*) :: title , title1 , title2 , title3
1965 Integer :: TimeInt
1966 Character (*) :: filename
1967
1968 Integer :: i
1969
1970 n1 = s i z e ( x d a t a 1 )
1971 n2 = s i z e ( x d a t a 2 )
1972
1973 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1974 ! W r i t e d a t a on two s e p a r a t e f i l e s
1975 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1976 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ ) ! P r o D a t a and r e l a t e d d a t a
1977 Do i =1 , n1
1978 W r i t e ( 1 0 , ’ ( A19 , 1 x , I9 , 1 x , I 9 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 a ( i ) , y d a t a 1 b ( i )
1979 End Do
1980 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
1981
1982 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ ) ! S u r v e y and r e l a t e d d a t a
1983 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( 1 ) , y d a t a 2 ( 1 ) ! Required for i f loop
1984 Do i =2 , n2
1985 I f ( y d a t a 2 ( i ) < y d a t a 2 ( i − 1) ) Then ! C r e a t e s gaps in the d at a
which w i l l c a u s e t h e l i n e t o be b r o k e n i n t h e g r a p h .
1986 Write (10 , * ) ! Gaps a r e p u t i n t h e d a t a f i l e
i f t h e t i m e b e t w e e n two p o i n t s i s more t h a n 24 h r s , t h i s means t h a t t h e l i n e s w i l l
continue for the n i g h t s h i f t stops .
1987 End I f
1988 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i )
1989 End Do
1990 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
1991
1992 ! C r e a t e g n u p l o t command f i l e
1993 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1994 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1995 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create .
png
1996 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / ’ / / t r i m ( f i l e n a m e ) / / ’ .
png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
1997 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e ) / / ’ } " ’ ! Graph T i t l e , t i t l e i n b o l d ,
works
1998 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes the
p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p .
F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
1999 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 1 ) / / ’ " ’
2000 W r i t e ( 1 0 , * ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 2 ) / / ’ " ’
2001 Write (10 , * ) ’ s e t y 2 t i c s ’
2002
2003 Write (10 , * ) ’ s e t xdata time ’
2004 W r i t e ( 1 0 , * ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
2005
2006 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t t o p box ’
2007
2008 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum o f
t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2009 Write (10 , * ) ’ s e t y2range [ 0 : * ] ’
2010
2011 Write (10 , * ) ’ s e t s t y l e l i n e 1 l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 1 p t 7 p s 1 ’ ! Red ,
TranspLenSum
2012 Write (10 , * ) ’ s e t s t y l e l i n e 2 l c r g b ’ ’ #00008 b ’ ’ l t 1 lw 1 p t 7 p s 1 ’ ! ( d a r k ) Blue ,
Away
2013 Write (10 , * ) ’ s e t s t y l e l i n e 3 l c r g b ’ ’ # f f a 5 0 0 ’ ’ l t 1 lw 1 p t 7 p s 2 ’ ! Orange ,
TimeIntAvAll
2014 Write (10 , * ) ’ s e t s t y l e l i n e 4 l c r g b ’ ’ #006400 ’ ’ l t 1 lw 1 p t 7 p s 2 ’ ! ( d a r k ) Green ,
PumpTime
2015
2016 I f ( p l o t _ t y p e ==2) W r i t e ( 1 0 , * ) ’ s e t l o g y ’ ! L o g a r i t h m i c s c a l e on t h e y − a x i s o n l y
2017 I f ( p l o t _ t y p e ==3) Then ! L o g a r i t h m i c s c a l e on b o t h a x i s .
2018 Write (10 , * ) ’ s e t log x ’
187

2019 Write (10 , * ) ’ s e t log y ’


2020 End I f
2021
2022 I f ( n1 > 0 .AND. n2 > 0 ) Then
2023 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h p o i n t s l s 3 a x e s x1y1 t i t l e " ’ / / TRIM (
t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 1 : 4 w i t h p o i n t s l s 4 a x e s x1y1 t i t l e " ’ / / TRIM ( t i t l e 3 ) / / ’
" , " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h l p l s 2 a x e s x1y2 t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’ !
B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s t h e y − d a t a becomes column 3 .
2024 End I f
2025
2026 I f ( n1 > 0 .AND. n2 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h p o i n t s p t 5 p s 1 t i t l e " ’ / /
TRIM ( t i t l e 1 ) / / ’ " ’ ! I f one o f t h e a r r a y s i s empty o n l y one g r a p h w i l l be p l o t e d .
2027
2028 I f ( n2 > 0 .AND. n1 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h p o i n t s p t 5 p s 1 t i t l e " ’ / /
TRIM ( t i t l e 2 ) / / ’ " ’
2029
2030 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2031
2032 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2033 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2034 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2035
2036 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s
expected .
2037
2038 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2039 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2040 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
2041
2042 ! Check m e s s a g e
2043 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2044 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( f i l e n a m e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
2045
2046 End S u b r o u t i n e
2047
2048 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2049
2050 S u b r o u t i n e f2gp3 ( Location , xdata1 , ydata1 , s t y l e 1 , xdata2 , ydata2 , s t y l e 2 , p l o t _ t y p e , filename , t i t l e ,
xlabel , ylabel , t i t l e 1 , t i t l e 2 )
2051 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
2052 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
2053 ! A d a p t e d t o my p u r p o s e s , a . o . d a t e t i m e a x i s .
2054 ! P l o t s t h e away v e r s u s t h e c a l c u l a t e d a v e r a g e s o u r c e l o c a t i o n .
2055 I m p l i c i t None
2056
2057 Integer : : n1 , n2 ! number o f d a t a p o i n t s
2058 Character (19) :: xdata1 ( : ) ! f i r s t x data array
2059 Real ( 8 ) :: ydata1 ( : ) ! f i r s t y data array
2060 Character (19) :: xdata2 ( : ) ! second x data a r r a y
2061 Real ( 8 ) :: ydata2 ( : ) ! second y data a r r a y
2062 Integer :: plot_type ! 1 for l i n e a r plot , 2 for
log plot , 3 for log −l o g p l o t
2063 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e , t i t l e 1 , t i t l e 2 ! plot axis labels
and t i t l e
2064 Character (*) :: filename
2065 Integer :: TimeInt
2066
2067 Integer :: i
2068
2069 Character (2) :: style1 , style2
2070 Character (25) :: Layout1 , L a y o u t 2
2071
2072 Character (*) :: Location
2073
2074 n1 = s i z e ( x d a t a 1 )
2075 n2 = s i z e ( x d a t a 2 )
2076
2077 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
188 E. Code of the SampleSource Program

2078 ! W r i t e d a t a on two s e p a r a t e f i l e s
2079 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2080 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ ) ! ProData data
2081 Do i =1 , n1
2082 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2083 End Do
2084 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2085
2086 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ ) ! Survey Data
2087 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( 1 ) , y d a t a 2 ( 1 ) ! Required for i f loop
2088 Do i =2 , n2
2089 I f ( y d a t a 2 ( i ) < y d a t a 2 ( i − 1) ) Then
2090 Write (10 , * ) ! Gaps a r e p u t i n t h e d a t a f i l e
i f t h e t i m e b e t w e e n two p o i n t s i s more t h a n 24 h r s , t h i s means t h a t t h e l i n e s w i l l
continue for the n i g h t s h i f t stops .
2091 End I f
2092
2093 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i )
2094 End Do
2095 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2096
2097 ! C r e a t e g n u p l o t command f i l e
2098 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2099 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2100 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create
. png
2101 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / ’ / / t r i m ( f i l e n a m e ) / / ’ .
png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2102 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e ) / / ’ } " ’ ! Graph T i t l e , t i t l e i n
b o l d , works
2103 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes
t h e p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s
o v e r l a p . F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
2104 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " ’
2105
2106 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x d a t a t i m e ’
2107 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
2108
2109 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : * ] ’ ! Forces the
minimum o f t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2110
2111 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key o p a q u e r i g h t t o p box ’
2112
2113 C a l l GraphStyle ( Style1 , Layout1 )
2114
2115 C a l l GraphStyle ( Style2 , Layout2 )
2116
2117 I f ( p l o t _ t y p e ==2) W r i t e ( 1 0 , * ) ’ s e t l o g y ’ ! L o g a r i t h m i c s c a l e on t h e y − a x i s o n l y
2118 I f ( p l o t _ t y p e ==3) Then ! L o g a r i t h m i c s c a l e on b o t h a x i s .
2119 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t l o g x ’
2120 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t l o g y ’
2121 End I f
2122
2123 I f ( n1 > 0 .AND. n2 > 0 ) Then
2124 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / /
’ " , " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’ !
B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s t h e y − d a t a becomes column 3 .
2125 End I f
2126
2127 I f ( n1 > 0 .AND. n2 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / /
TRIM ( t i t l e 1 ) / / ’ " ’ ! I f one o f t h e a r r a y s i s empty o n l y one g r a p h w i l l be p l o t e d .
2128
2129 I f ( n2 > 0 .AND. n1 ==0) W r i t e ( 1 0 , * ) ’ p l o t " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / /
TRIM ( t i t l e 2 ) / / ’ " ’
2130
2131 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2132
2133 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2134 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2135 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
189

2136
2137 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2138
2139 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2140 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2141 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
2142
2143 ! Check m e s s a g e
2144 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2145 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( f i l e n a m e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
2146
2147 End S u b r o u t i n e
2148
2149 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2150
2151 S u b r o u t i n e f2gpLagD ( l o c a t i o n , t i t l e _ g r a p h , x d a t a 1 , y d a t a 1 , p l o t _ t y p e , x l a b e l , y l a b e l , f i l e n a m e ,
title1 , style1 , style2 , style3 , style4 )
2152 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
2153 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
2154 ! SPECIAL CASE ; t h e r e i s o n l y one d a t a s e t which i s d i v i d e d i n t o t h r e e p a r t s , s t y l e a s s u c h
i s put in manually i n s t e a d of with the s u b r o u t i n e .
2155 ! P l o t s the lag diagram .
2156 I m p l i c i t None
2157
2158 Integer : : n1 ! number o f d a t a p o i n t s
2159 Real ( 8 ) :: xdata1 ( : ) ! f i r s t x data array
2160 Real ( 8 ) :: ydata1 ( : ) ! f i r s t y data array
2161 Integer :: plot_type ! 1 for l i n e a r plot , 2 for log
plot , 3 for log −l o g p l o t
2162 Character (*) :: xlabel , ylabel , filename , t i t l e 1 , t i t l e _ g r a p h
2163 ! Integer :: TimeInt
2164
2165 Character (2) :: style1 , style2 , style3 , style4
2166 Character (25) :: Layout1 , Layout2 , Layout3 , L a y o u t 4
2167
2168 Integer :: i, j, k
2169
2170 Character (*) :: Location
2171
2172 n1 = s i z e ( x d a t a 1 )
2173
2174 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2175 ! Write data in f i l e s
2176 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2177
2178 Open ( 1 0 , F i l e = ’ x y d a t a 0 . d a t ’ )
2179 Open ( 1 1 , F i l e = ’ x y d a t a 1 . d a t ’ )
2180 Open ( 1 2 , F i l e = ’ x y d a t a 2 . d a t ’ )
2181
2182 Do i = 1 , n1 ! ROP = 0 , VT=VL
2183 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , x d a t a 1 ( i )
2184 End do
2185
2186 I f ( L o c a t i o n == ’ T e x e l ’ ) Then
2187
2188 Do i =1 ,24
2189 W r i t e ( 1 1 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2190 End Do
2191
2192 Do i =25 , n1
2193 W r i t e ( 1 2 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2194 End Do
2195
2196 E l s e I f ( L o c a t i o n == ’ Den H e l d e r ’ ) Then
2197
2198 Do i =1 ,20
2199 W r i t e ( 1 1 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
190 E. Code of the SampleSource Program

2200 End Do
2201
2202 Do i =21 , n1 −1 ! L a s t s a m p l e i n Den H e l d e r i s n o t v a l i d .
2203 W r i t e ( 1 2 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2204
2205 End Do
2206 End I f
2207
2208 Close (10)
2209 Close (11)
2210 Close (12)
2211
2212
2213
2214 ! C r e a t e g n u p l o t command f i l e
2215 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2216 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2217
2218 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l png s i z e 1 8 0 0 , 1 8 0 0 ’ ! Sets i t to
c r e a t e . png
2219 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / ’ / / t r i m ( f i l e n a m e ) / / ’ .
png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2220 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e _ g r a p h ) / / ’ } " o f f s e t 0 , − 1 font " ,32" ’
! Graph T i t l e , t i t l e i n b o l d , works
2221 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 0 . 5 f o n t " , 2 4 " ’ !
O f f s e t c h a n g e s t h e p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and
t i c l a b e l s o v e r l a p . F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
2222 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " o f f s e t 2 , 0 font " ,24" ’
2223
2224 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s i z e 0 . 9 8 ’
2225 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o r i g i n 0 . 0 1 , 0 ’
2226
2227 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : * ] ’ ! Forces the
minimum o f t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2228
2229 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d ’
2230 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key box o p a q u e r i g h t b o t t o m f o n t " , 2 4 " s p a c i n g 1 . 3 ’ !
Box c a n be a d d e d t o p u t a box a r o u n d t h e key , i t o v e r l a p s w i t h t h e l e t t e r s s o i t was
removed
2231
2232 Call GraphStyle ( Style1 , Layout1 )
2233 Call GraphStyle ( Style2 , Layout2 )
2234 Call GraphStyle ( Style3 , Layout3 )
2235 Call GraphStyle ( Style4 , Layout4 )
2236
2237 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / ’ NAP− 85m J e t b i t ,
’ / / TRIM ( t i t l e 1 ) / / ’ " , " x y d a t a 2 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / ’ NAP− 85m
Mudmotor , ’ / / Trim ( t i t l e 1 ) / / ’ " , " x y d a t a 3 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 3 / / ’ t i t l e " ’ / / ’ NAP
−65m J e t b i t , ’ / / Trim ( t i t l e 1 ) / / ’ " , " x y d a t a 0 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 4 / / ’ t i t l e " ’ / / ’
ROP = 0 , ’ / / TRIM ( t i t l e 1 ) / / ’ " ’
2238
2239 I f ( L o c a t i o n == ’ T e x e l ’ ) Then
2240 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 0 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 4 / / ’ t i t l e " ’ / / ’ROP = 0 , ’ / /
TRIM ( t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / ’NAP− 65m, ’ / / Trim (
t i t l e 1 ) / / ’ " , " xydata2 . dat " using 1:2 with ’ / / L a y o u t 3 / / ’ t i t l e " ’ / / ’NAP −85m, ’ / / Trim (
title1 ) // ’" ’
2241 E l s e I f ( L o c a t i o n == ’ Den H e l d e r ’ ) Then
2242 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 0 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 4 / / ’ t i t l e " ’ / / ’ROP = 0 , ’ / /
TRIM ( t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / ’NAP− 85m, ’ / / Trim (
t i t l e 1 ) / / ’ " , " xydata2 . dat " using 1:2 with ’ / / L a y o u t 3 / / ’ t i t l e " ’ / / ’NAP −65m, ’ / / Trim (
title1 ) // ’" ’
2243 End I f
2244
2245 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2246
2247 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2248 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2249 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2250
2251 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
191

.
2252
2253 Call SYSTEM( ’ del gp . t x t ’ )
2254 Call SYSTEM( ’ del xydata0 . dat ’ )
2255 Call SYSTEM( ’ del xydata1 . dat ’ )
2256 Call SYSTEM( ’ del xydata2 . dat ’ )
2257
2258 ! Check m e s s a g e
2259 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2260 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( f i l e n a m e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
2261
2262 End S u b r o u t i n e
2263
2264 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2265
2266 S u b r o u t i n e f 2 g p 5 ( ID , x d a t a 1 , y d a t a 1 , s t y l e 1 , p l o t _ t y p e , x l a b e l , y l a b e l , t i t l e , t i t l e 1 )
2267 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
2268 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
2269 ! Alpha D e l t a , s u b r o u t i n e i s n o t c a l l e d anymore , i t i s i n c l u d e d i n f 2 g p S a m p l e M u l t i .
2270 I m p l i c i t None
2271
2272 Character (*) : : ID ! Sample ID . , u s e d f o r
t i t l e o f g r a p h and g r a p h f i l e n a m e .
2273 Integer : : n1 ! number o f d a t a p o i n t s
2274 Real ( 8 ) :: xdata1 ( : ) ! f i r s t x data array
2275 Real ( 8 ) :: ydata1 ( : ) ! f i r s t y data array
2276 Integer :: plot_type ! 1 for l i n e a r plot , 2 for
l o g p l o t , 3 f o r log −l o g p l o t
2277 Character (2) :: style1
2278 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e , t i t l e 1 ! p l o t a x i s l a b e l s and
title (s)
2279 Character (25) :: Layout1
2280
2281 Integer :: i
2282
2283 n1 = s i z e ( x d a t a 1 )
2284
2285 ! W r i t e ( * , * ) n1
2286
2287 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2288 ! Write data in f i l e s
2289 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2290 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2291
2292 Do i =1 , n1
2293 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2294 End do
2295
2296 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2297
2298 ! C r e a t e g n u p l o t command f i l e
2299 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2300 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2301
2302 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 1 2 0 0 , 1 2 0 0 ’ ! Sets i t to create .
png
2303 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t ’ / / ID / / ’ ’ / /
T i t l e / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r .
The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2304 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ ’ / / ID / / ’ } " ’ ! Graph T i t l e , t i t l e i n b o l d
, works
2305 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes the
p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p .
F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
2306 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " ’
2307
2308 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum o f
t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
192 E. Code of the SampleSource Program

2309
2310 ! W r i t e ( 1 0 , * ) ’ s e t key opaque ’
2311 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t b o t t o m box ’
2312
2313 C a l l GraphStyle ( Style1 , Layout1 )
2314
2315 I f ( p l o t _ t y p e ==2) W r i t e ( 1 0 , * ) ’ s e t l o g y ’ ! L o g a r i t h m i c s c a l e on t h e y − a x i s o n l y
2316 I f ( p l o t _ t y p e ==3) Then ! L o g a r i t h m i c s c a l e on b o t h a x i s .
2317 Write (10 , * ) ’ s e t log x ’
2318 Write (10 , * ) ’ s e t log y ’
2319 End I f
2320
2321 W r i t e ( 1 0 , ’ (A, I , A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / /
’" ’
2322
2323 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2324
2325 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2326 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2327 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2328
2329 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2330
2331 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2332 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2333
2334 ! Check m e s s a g e
2335 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2336 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / ID / / ’ ’ / / T i t l e / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
2337
2338 End S u b r o u t i n e
2339
2340 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2341
2342 S u b r o u t i n e f 2 g p 6 ( ID , x d a t a 1 , y d a t a 1 , s t y l e 1 , x d a t a 2 , y d a t a 2 , s t y l e 2 , p l o t _ t y p e , x l a b e l , y l a b e l , t i t l e ,
title1 , title2 )
2343 ! W r i t e s f i l e ( s ) w i t h d a t a f o r g r a p h ( s ) , w r i t e s a f i l e t o be r e a d by g n u p l o t and c a l l s
g n u p l o t t o r e a d i t and c o n s t r u c t a g r a p h a c c o r d i n g t o t h e i n s t r u c t i o n s i n t h e f i l e and
the data in the f i r s t f i l e ( s ) .
2344 ! S o u r c e : h t t p : / / i m p l i c i t n o n e . com / f o r t r a n − g n u p l o t / , s i m p l e and more t o t h e p o i n t t h a n t h e
PlotModule . f90
2345 ! F l u i d m e a s u r e m e n t s and c a l c u l a t i o n r e s u l t s , s u b r o u t i n e i s n o t c a l l e d anymore , i t i s
included in f2gpSampleMulti .
2346 I m p l i c i t None
2347
2348 Character (*) : : ID ! Sample ID . , u s e d f o r
t i t l e o f g r a p h and g r a p h f i l e n a m e .
2349 Integer : : n1 ! number o f d a t a p o i n t s
2350 Real ( 8 ) :: xdata1 ( : ) , xdata2 ( : ) ! f i r s t x data array
2351 Real ( 8 ) :: ydata1 ( : ) , ydata2 ( : ) ! f i r s t y data array
2352 Integer :: plot_type ! 1 for l i n e a r plot , 2 for
l o g p l o t , 3 f o r log −l o g p l o t
2353
2354 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e , t i t l e 1 , t i t l e 2 ! p l o t a x i s l a b e l s and
title (s)
2355 Character (2) :: style1 , style2
2356 Character (25) :: Layout1 , L a y o u t 2
2357
2358 Integer :: i
2359
2360 n1 = s i z e ( x d a t a 1 )
2361
2362 ! W r i t e ( * , * ) n1
2363
2364 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2365 ! Write data in f i l e s
2366 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2367 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2368
2369 Do i =1 , n1
193

2370 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2371 End do
2372
2373 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2374
2375 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ )
2376
2377 Do i =1 , n1
2378 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i )
2379 End do
2380
2381 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2382
2383 ! C r e a t e g n u p l o t command f i l e
2384 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2385 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2386
2387 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 1 2 0 0 , 1 2 0 0 ’ ! Sets i t to create .
png
2388 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t ’ / / ID / / ’ ’ / /
T i t l e / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r .
The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2389 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ ’ / / ID / / ’ } " ’ ! Graph T i t l e , t i t l e i n b o l d
, works
2390 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes the
p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p .
F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
2391 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " ’
2392
2393 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum o f
t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2394
2395 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t b o t t o m box ’
2396
2397 C a l l GraphStyle ( Style1 , Layout1 )
2398
2399 C a l l GraphStyle ( Style2 , Layout2 )
2400
2401 I f ( p l o t _ t y p e == 2 ) W r i t e ( 1 0 , * ) ’ s e t l o g y ’ ! L o g a r i t h m i c s c a l e on t h e y − a x i s o n l y
2402 I f ( p l o t _ t y p e == 3 ) Then ! L o g a r i t h m i c s c a l e on b o t h a x i s .
2403 Write (10 , * ) ’ s e t log x ’
2404 Write (10 , * ) ’ s e t log y ’
2405 End I f
2406
2407 W r i t e ( 1 0 , ’ (A, I , A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / /
’ " , " x y d a t a 2 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’
2408
2409 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2410
2411 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2412 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2413 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2414
2415 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2416
2417 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2418 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2419 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
2420
2421 ! Check m e s s a g e
2422 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2423 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / ID / / ’ ’ / / T i t l e / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
2424
2425 End S u b r o u t i n e
2426
2427 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2428
2429 S u b r o u t i n e f 2 g p S a m p l e M u l t i ( ID , n0 , n5 , n6 , x d a t a 0 , y d a t a 0 , s t y l e 0 , x d a t a 5 , y d a t a 5 , s t y l e 5 , x d a t a 1 ,
ydata1 , s t y l e 1 , xdata2 , ydata2 , s t y l e 2 , ydata3 , s t y l e 3 , ydata4 , s t y l e 4 , xlabel0 , ylabel0 , xlabel1 ,
ylabel1 , xlabel2 , ylabel2 , t i t l e , t i t l e 0 , t i t l e 1 , t i t l e 2 , g_title1 , g_title2 , g_title3 , g_title4 ,
194 E. Code of the SampleSource Program

g_title5 , g_title6 , Scenario )


2430 ! ( Sample_Code , Index_PD , I n d e x _ S u r , Index_Sol_PD , DateTime_PD , TranspLenSum , ’ 2 a ’ , DateTime_Sur , Away
, ’ 2 b ’ , A l p h a _ A l l , D e l t a _ A l l , ’ 2 c ’ , GammaY , Tau , ’ 3 a ’ , Tau_Calc_HB , ’ 3 b ’ , Tau_Calc_BH , ’ 3 c ’ , ’ D a t e
Time ’ , ’ L e n g t h [m] ’ , ’ Alpha [ − ] ’ , ’ D e l t a ’ , ’ S h e a r R a t e [ 1 / s ] ’ , ’ S h e a r S t r e s s [ Pa ] ’ , ’ Sample
P a r a m e t e r s ’ , ’ I n t e r s e c t i o n ’ , ’ Alpha v s . D e l t a ’ , ’ M e a s u r e m e n t s v s . C a l c u l a t i o n s ’ , ’ D e v i a t i o n
’ , ’ Measurements ’ , ’ H e r s c h e l B u l k l e y ’ , ’ Bingham ’ )
2431 ! f 2 g p 6 ( ID , x d a t a 1 , y d a t a 1 , s t y l e 1 , x d a t a 2 , y d a t a 2 , s t y l e 2 , p l o t _ t y p e , x l a b e l , y l a b e l , t i t l e , t i t l e 1 ,
title2
2432
2433 ! Character (*) , Parameter :: filefolder_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ " ! Outputfiles
2434 Character (*) , Parameter :: filefolderScenarios_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ S c e n a r i o s \ "
2435 Character (*) : : ID ! Sample ID . , u s e d f o r
t i t l e o f g r a p h and g r a p h f i l e n a m e .
2436 Integer : : n1 , n2 , n0 , n5 , n6 ! number o f
data points
2437 Real ( 8 ) :: xdata1 ( : ) , xdata2 ( : ) ! f i r s t x data
array
2438 Real ( 8 ) :: ydata1 ( : ) , ydata2 ( : ) , ydata3 ( : ) , ydata4 ( : ) , ydata0 ( : ) , ydata5 ( : )
! f i r s t y data array
2439 Character (2) :: style1 , style2 , style3 , style4 , style0 , style5
2440 C h a r a c t e r ( l e n =* ) :: xlabel0 , ylabel0 , xlabel1 , ylabel1 , xlabel2 , ylabel2
2441 C h a r a c t e r ( l e n =* ) :: title , title0 , title1 , g_title1 , title2 , g_title2 , g_title3 , g_title4 ,
g_title5 , g_title6 ! p l o t a x i s l a b e l s and t i t l e ( s )
2442 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout0 , L a y o u t 5
2443
2444 Character (19) :: xdata0 ( : ) , xdata5 ( : )
2445
2446 Character (19) :: DateTimeSource
2447 Character (19) :: DateTimeSample
2448 Character (19) :: DateTimeMin
2449 Character (19) :: DateTimeMax
2450
2451 Integer :: TimeInt
2452
2453 Integer :: i, Y
2454
2455 Integer :: TimeIntGP
2456
2457 Integer (2) :: Day , Day_Min , Day_Max
2458 Integer (2) :: Month , Month_Min , Month_Max
2459 Integer (4) :: Year
2460 Integer (2) :: Hours , M i n u t e s , S e c o n d s
2461
2462 Integer , optional :: Scenario
2463 Character (100) :: Filename
2464
2465 n1 = s i z e ( x d a t a 1 )
2466 n2 = s i z e ( x d a t a 2 )
2467
2468
2469 DateTimeSource = x d a t a 0 ( n6 )
2470 DateTimeSample = x d a t a 0 ( n0 )
2471
2472 Y = 6 ! Amount o f h o u r s t h a t w i l l be s u b s t r a c t e d from t h e s o u r c e d a t e t i m e and a d d e d
t o i t , i n o r d e r t o r e s p e c t i v e l y form t h e mimimum and maximum o f t h e zoomed p l o t
2473 C a l l ZoomGPHours ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , Y)
2474
2475 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2476 ! Write data in f i l e s
2477 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2478 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 0 . d a t ’ ) ! ProData data
2479 Do i =1 , n0
2480 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 0 ( i ) , y d a t a 0 ( i )
2481 End Do
2482 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2483
2484 I f ( P r e s e n t ( S c e n a r i o ) ) Then
2485 ! W r i t e ( F i l e n a m e , ’ ( A, A, A, I 2 . 2 ,A) ’ ) ’ PumpedVol ’ , t r i m ( ID ) , ’ S c e n a r i o ’ , S c e n a r i o , ’ . t x t ’
2486 W r i t e ( F i l e n a m e , ’ (A, A, I 2 . 2 ,A) ’ ) t r i m ( ID ) , ’ PumpedVol S c e n a r i o ’ , S c e n a r i o , ’ . t x t ’
195

2487 Open ( 1 1 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = f i l e f o l d e r S c e n a r i o s _ o u t / / t r i m ( F i l e n a m e ) )
2488 Do i =1 , n0
2489 W r i t e ( 1 1 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 0 ( i ) , y d a t a 0 ( i )
2490 End Do
2491 C l o s e ( 1 1 , S t a t u s = ’ Keep ’ )
2492 End I f
2493
2494 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2495
2496 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 5 . d a t ’ ) ! Survey Data
2497 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 5 ( 1 ) , y d a t a 5 ( 1 ) ! Required for i f loop
2498 Do i =2 , n5
2499 I f ( y d a t a 5 ( i ) < y d a t a 5 ( i − 1) ) Then
2500 Write (10 , * )
2501 End I f
2502 ! C a l l T i m e I n t e r v a l T w o V a l u e s ( T i m e I n t , x d a t a 5 ( i ) , x d a t a 5 ( i − 1) )
2503 ! I f ( T i m e I n t >= ( 2 4 * 60 * 6 0 ) ) Then ! C r e a t e s gaps in the data
which w i l l c a u s e t h e l i n e t o be b r o k e n i n t h e g r a p h .
2504 ! Write (10 , * ) ! Gaps a r e p u t in the data
f i l e i f t h e t i m e b e t w e e n two p o i n t s i s more t h a n 24 h r s , t h i s means t h a t the lines will
continue for the n i g h t s h i f t stops .
2505 ! End I f
2506 W r i t e ( 1 0 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 5 ( i ) , y d a t a 5 ( i )
2507 End Do
2508 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2509
2510 I f ( P r e s e n t ( S c e n a r i o ) ) Then
2511 W r i t e ( F i l e n a m e , ’ (A, A, I 2 . 2 ,A) ’ ) t r i m ( ID ) , ’ Away S c e n a r i o ’ , S c e n a r i o , ’ . t x t ’
2512 Open ( 1 1 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = f i l e f o l d e r S c e n a r i o s _ o u t / / t r i m ( F i l e n a m e ) )
2513 W r i t e ( 1 1 , ’ ( A19 , F9 . 3 ) ’ ) x d a t a 5 ( 1 ) , y d a t a 5 ( 1 )
2514 Do i =2 , n5
2515 I f ( y d a t a 5 ( i ) < y d a t a 5 ( i − 1) ) Then
2516 Write (11 , * )
2517 End I f
2518 W r i t e ( 1 1 , ’ ( A19 , 1 x , F9 . 3 ) ’ ) x d a t a 5 ( i ) , y d a t a 5 ( i )
2519 End Do
2520 C l o s e ( 1 1 , S t a t u s = ’ Keep ’ )
2521 End I f
2522
2523 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2524
2525 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2526 ! Alpha / D e l t a
2527 Do i =1 , n1
2528 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i )
2529 End do
2530
2531 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2532
2533 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2534
2535 Open ( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ )
2536 ! HB/ Bingham / Measured
2537 Do i =1 , n2
2538 W r i t e ( 1 0 , ’ ( F9 . 3 , 1 x , F9 . 3 , 1 x , F9 . 3 , 1 x , F9 . 3 ) ’ ) x d a t a 2 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i )
2539 End do
2540
2541 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
2542
2543 ! C r e a t e g n u p l o t command f i l e
2544 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2545 Open ( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2546 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 2 4 0 0 ’ ! Sets i t to create .
png
2547
2548 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) t r i m ( ID ) / / ’ P l o t S c e n a r i o ’ , S c e n a r i o , ’ . png ’
2549 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / S a m p l e s / ’ / / t r i m (
filename ) / / ’" ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / " u s e d
i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2550
2551 Write (10 , * ) ’ s e t m u l t i p l o t title ’ / / ’ " { / : Bold ’ / / t r i m ( f i l e n a m e ) / / ’ } " f o n t " , 2 2 " ’
196 E. Code of the SampleSource Program

2552 Write (10 , * ) ’ s e t title ’ / / ’ " { / : Bold ’ / / ’ Alpha v s . D e l t a } " ’ ! Graph T i t l e , t i t l e i n bold ,
2553
2554 ! Write (10 ,8) ’ s e t xdata ’
2555
2556 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l 1 ) / / ’ " ’ ! Offset changes the p o s i t i o n of
t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p . F i r s t number
o f f s e t s the horizontal position .
2557 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 1 ) / / ’ " ’
2558
2559 Write (10 , * ) ’ s e t s i z e 0 . 5 , 0 . 5 ’
2560 Write (10 , * ) ’ s e t o r i g i n 0 . 0 , 0 . 0 ’
2561
2562 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t t o p box ’
2563
2564 Write (10 , * ) ’ s e t g r i d ’
2565
2566 write (10 , * ) ’ s e t xrange [ * : * ] ’
2567 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum o f
t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2568
2569 C a l l GraphStyle ( Style1 , Layout1 )
2570
2571 ! C a l l GraphStyle ( Style2 , Layout2 )
2572
2573 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 1 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 1 ) / / ’ "
’ ! B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s t h e y − d a t a becomes
column 3 .
2574
2575 ! Now we s e t the o p t i o n s f o r the second p l o t
2576 Write (10 , * ) ’ set size 0.5 ,0.5 ’
2577 Write (10 , * ) ’ set origin 0.5 ,0.0 ’
2578 Write (10 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t i t l e 2 / / ’ } " ’
2579
2580 write (10 , * ) ’ s e t xrange [ * : * ] ’
2581 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
2582
2583 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l 2 ) / / ’ " ’
2584 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 2 ) / / ’ " ’
2585
2586 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t b o t t o m box ’
2587
2588 Write (10 , * ) ’ s e t g r i d ’
2589
2590 C a l l GraphStyle ( Style2 , Layout2 )
2591 C a l l GraphStyle ( Style3 , Layout3 )
2592 C a l l GraphStyle ( Style4 , Layout4 )
2593
2594 ! L a r g e p l o t w i t h zoomed a x i s .
2595 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 2 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 2 ) / / ’
" , " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 3 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 3 ) / / ’ " , " x y d a t a 2 . d a t "
u s i n g 1 : 4 w i t h ’ / / L a y o u t 4 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 4 ) / / ’ " ’
2596
2597 Write (10 , * ) ’ s e t xdata time ’
2598 W r i t e ( 1 0 , * ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
2599
2600 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / ’ I n t e r s e c t i o n } " ’ ! Graph T i t l e , t i t l e i n b o l d ,
works
2601 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / TRIM ( x l a b e l 0 ) / / ’ " o f f s e t 0 , − 1 ’ ! Offset changes the
p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and t i c l a b e l s o v e r l a p .
F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
2602 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 0 ) / / ’ " ’
2603 W r i t e ( 1 0 , * ) ’ s e t y t i c s 500 ’
2604 Write (10 , * ) ’ s e t mytics 5 ’
2605
2606 Write (10 , * ) ’ s e t s i z e 1 ,0.49 ’
2607 Write (10 , * ) ’ s e t o r i g i n 0.0 ,0.49 ’
2608
2609 Write (10 , * ) ’ s e t g r i d mytics y t i c s x t i c s ’
2610
2611 W r i t e ( 1 0 , * ) ’ s e t key o p a q u e r i g h t b o t t o m box ’
2612
197

2613 ! write (10 , * ) ’ s e t xrange [ * : * ] ’


2614 ! Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum
o f t h e y − a x i s t o be 0 w h i l e t h e u p p e r l i m i t i s still flexible .
2615
2616 W r i t e ( 1 0 , ’ (A, A, A, A, A) ’ ) ’ s e t x r a n g e [ " ’ , DateTimeMin , ’ " : " ’ , DateTimeMax , ’ " ] ’
2617 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
2618
2619 C a l l GraphStyle ( Style0 , Layout0 )
2620
2621 C a l l GraphStyle ( Style5 , Layout5 )
2622
2623 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 0 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 0 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 5 ) / / ’
" , " x y d a t a 5 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 5 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 6 ) / / ’ " ’ !
B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s t h e y − d a t a becomes column 3 .
2624
2625 ! Smaller plot
2626 Write (10 , * ) ’ s e t s i z e 0.3 ,0.145 ’
2627 Write (10 , * ) ’ s e t o r i g i n 0.65 ,0.645 ’
2628 Write (10 , * ) ’ s e t bmargin 3 ; s e t tmargin 3 ; s e t lmargin 6 ; s e t rmargin 2 ’ !
D e t e r m i n e s t h e s i z e o f t h e c a n v a s t h a t i s c l e a n e d a r o u n d t h e p l o t ( e x c l u d e s t h e t i t l e and
axis )
2629 Write (10 , * ) ’ c l e a r ’
2630 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / ’ Overview } " ’
2631
2632 ! W r i t e ( 1 0 , ’ ( A, A, A, A, A) ’ ) ’ s e t x r a n g e [ " ’ , DateTimeMin , ’ " : " ’ , DateTimeMax , ’ " ] ’
2633 ! Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
2634
2635 Write (10 , * ) ’ s e t xdata time ’
2636 W r i t e ( 1 0 , * ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
2637
2638 write (10 , * ) ’ s e t xrange [ * : * ] ’
2639 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’
2640
2641 Write (10 , * ) ’ s e t xlabel "" ’
2642 Write (10 , * ) ’ s e t ylabel "" ’
2643 Write (10 , * ) ’ s e t y t i c s 5000 ’
2644 Write (10 , * ) ’ unset mytics ’
2645
2646 W r i t e ( 1 0 , * ) ’ s e t key o f f ’
2647 Write (10 , * ) ’ unset g r i d ’
2648 Write (10 , * ) ’ s e t g r i d x t i c s y t i c s ’
2649
2650 ! Smaller plot
2651 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 0 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 0 / / ’ t i t l e " ’ / / TRIM ( t i t l e 1 ) / / ’ " ,
" x y d a t a 5 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 5 / / ’ t i t l e " ’ / / TRIM ( t i t l e 2 ) / / ’ " ’
2652
2653 ! It ’ s important to close the m u l t i p l o t environment ! ! !
2654 Write (10 , * ) ’ unset m u l t i p l o t ’
2655
2656 C l o s e ( 1 0 , STATUS= ’KEEP ’ )
2657
2658
2659
2660 Open ( 1 0 , f i l e = ’ gp2 . t x t ’ )
2661
2662 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 1 1 0 0 , 1 1 0 0 ’
2663
2664 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) t r i m ( ID ) / / ’ _ F l u i d _ M o d e l s _ ’ , S c e n a r i o , ’ . png ’
2665 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / S a m p l e s / ’ / / t r i m (
filename ) / / ’" ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / " u s e d
i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2666
2667 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e f o n t " , 2 8 " ’ / / ’ " { / : Bold ’ / / ’ F l u i d Model C o m p a r i s o n ’ / / t r i m ( ID ) / / ’ } "

2668
2669 w r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ 0 : * ] ’
2670 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : * ] ’
2671
2672 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l " S h e a r R a t e [ 1 / s ] " f o n t " , 2 4 " ’
2673 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l " S h e a r S t r e s s [ Pa ] " f o n t " , 2 4 " ’
2674
198 E. Code of the SampleSource Program

2675 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key b o t t o m r i g h t box f o n t " , 2 0 " ’


2676
2677 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t b m a r g i n a t s c r e e n 0 . 0 7 ’
2678
2679 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d ’
2680
2681 C a l l GraphStyle ( Style2 , Layout2 )
2682 C a l l GraphStyle ( Style3 , Layout3 )
2683 C a l l GraphStyle ( Style4 , Layout4 )
2684
2685 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 2 . d a t " u s i n g 1 : 2 w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 2 ) / / ’
" , " x y d a t a 2 . d a t " u s i n g 1 : 3 w i t h ’ / / L a y o u t 3 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 3 ) / / ’ " , " x y d a t a 2 . d a t "
u s i n g 1 : 4 w i t h ’ / / L a y o u t 4 / / ’ t i t l e " ’ / / TRIM ( g _ t i t l e 4 ) / / ’ " ’
2686
2687 Close (10)
2688
2689 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2690 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2691 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2692 C a l l SYSTEM( ’ g n u p l o t gp2 . t x t ’ )
2693
2694 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2695
2696 Call SYSTEM( ’ del gp . t x t ’ )
2697 Call SYSTEM( ’ del gp2 . t x t ’ )
2698 Call SYSTEM( ’ del xydata0 . dat ’)
2699 Call SYSTEM( ’ del xydata1 . dat ’)
2700 Call SYSTEM( ’ del xydata2 . dat ’)
2701 Call SYSTEM( ’ del xydata5 . dat ’)
2702
2703 ! Check m e s s a g e
2704 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2705 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( f i l e n a m e ) / / ’ " ’ / / ’ i s c r e a t e d . ’
2706
2707 End S u b r o u t i n e
2708
2709 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2710
2711 S u b r o u t i n e G r a p h S t y l e ( S t y l e , Layout , I n d e x )
2712 ! I n o r d e r t o c r e a t e u n i f o r m i t y i n t h e o u t p u t , t h i s i s s e p a r a t e d from t h e p l o t s u b r o u t i n e s
s o i t c a n be u s e d by a l l o f t h o s e .
2713 I m p l i c i t None
2714
2715 Character (2) :: style
2716 Character (25) :: Layout
2717 Integer , Optional : : Index
2718
2719 S e l e c t Case ( s t y l e )
2720 Case ( ’ 1 a ’ )
2721 Layout = ’ l i n e s l s 1 ’
2722 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2723 I f ( P r e s e n t ( I n d e x ) ) Then
2724 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2725 Else
2726 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2727 End I f
2728
2729 Case ( ’ 1 b ’ )
2730 Layout = ’ l i n e s l s 2 ’
2731 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2732 I f ( P r e s e n t ( I n d e x ) ) Then
2733 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1

2734 Else
2735 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1 ’
2736 End I f
2737
2738 Case ( ’ 1 c ’ )
2739 Layout = ’ l i n e s l s 3 ’
2740 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
199

2741 I f ( P r e s e n t ( I n d e x ) ) Then
2742 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2743 Else
2744 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2745 End I f
2746
2747 Case ( ’ 1 d ’ )
2748 Layout = ’ l i n e s l s 4 ’
2749 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2750 I f ( P r e s e n t ( I n d e x ) ) Then
2751 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s
1’
2752 Else
2753 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2754 End I f
2755
2756 Case ( ’ 1 e ’ )
2757 Layout = ’ l i n e s l s 5 ’
2758 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2759 I f ( P r e s e n t ( I n d e x ) ) Then
2760 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " m a g e n t a " l t 1 lw 2 p t 7 p s 1 ’
2761 Else
2762 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " m a g e n t a " l t 1 lw 2 p t 7 p s 1 ’
2763 End I f
2764
2765 Case ( ’ 1 f ’ )
2766 Layout = ’ l i n e s l s 6 ’
2767 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2768 I f ( P r e s e n t ( I n d e x ) ) Then
2769 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s a n d y b r o w n " l t 1 lw 2 p t 7 p s
1’
2770 Else
2771 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " s a n d y b r o w n " l t 1 lw 2 p t 7 p s 1 ’
2772 End I f
2773
2774 Case ( ’ 1 g ’ )
2775 Layout = ’ l i n e s l s 7 ’
2776 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2777 I f ( P r e s e n t ( I n d e x ) ) Then
2778 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s
1’
2779 Else
2780 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s 1 ’
2781 End I f
2782
2783 Case ( ’ 1 h ’ )
2784 Layout = ’ l i n e s l s 8 ’
2785 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2786 I f ( P r e s e n t ( I n d e x ) ) Then
2787 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s p r i n g − g r e e n " l t 1 lw 2 p t 7
ps 1 ’
2788 Else
2789 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " s p r i n g − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2790 End I f
2791
2792 Case ( ’ 1 i ’ )
2793 Layout = ’ l i n e s l s 9 ’
2794 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2795 I f ( P r e s e n t ( I n d e x ) ) Then
2796 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " c y a n " l t 1 lw 2 p t 7 p s 1 ’
2797 Else
2798 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " c y a n " l t 1 lw 2 p t 7 p s 1 ’
2799 End I f
2800
2801 Case ( ’ 1 j ’ )
2802 L a y o u t = ’ l i n e s l s 10 ’
2803 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2804 I f ( P r e s e n t ( I n d e x ) ) Then
2805 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " k h a k i " l t 1 lw 2 p t 7 p s 1 ’
2806 Else
2807 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " k h a k i " l t 1 lw 2 p t 7 p s 1 ’
200 E. Code of the SampleSource Program

2808 End I f
2809
2810 Case ( ’ 1 k ’ ) ! Redish
2811 L a y o u t = ’ l i n e s l s 11 ’
2812 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2813 I f ( P r e s e n t ( I n d e x ) ) Then
2814 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 3 p t 7 p s 1

2815 Else
2816 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 3 p t 7 p s 1 ’
2817 End I f
2818
2819 Case ( ’ 1 l ’ )
2820 L a y o u t = ’ l i n e s l s 12 ’
2821 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2822 I f ( P r e s e n t ( I n d e x ) ) Then
2823 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 1

2824 Else
2825 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 1 ’
2826 End I f
2827
2828 Case ( ’ 1m’ )
2829 L a y o u t = ’ l i n e s l s 13 ’
2830 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2831 I f ( P r e s e n t ( I n d e x ) ) Then
2832 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2833 Else
2834 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2835 End I f
2836
2837 Case ( ’ 1 n ’ )
2838 L a y o u t = ’ l i n e s l s 14 ’
2839 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2840 I f ( P r e s e n t ( I n d e x ) ) Then
2841 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 7 p s
1’
2842 Else
2843 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 14 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 7 p s 1 ’
2844 End I f
2845
2846 Case ( ’ 1 o ’ )
2847 L a y o u t = ’ l i n e s l s 15 ’
2848 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2849 I f ( P r e s e n t ( I n d e x ) ) Then
2850 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " m a g e n t a " l t 1 lw 3 p t 7 p s 1 ’
2851 Else
2852 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 15 l c r g b " m a g e n t a " l t 1 lw 3 p t 7 p s 1 ’
2853 End I f
2854
2855 Case ( ’ 1 p ’ )
2856 L a y o u t = ’ l i n e s l s 16 ’
2857 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2858 I f ( P r e s e n t ( I n d e x ) ) Then
2859 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s a n d y b r o w n " l t 1 lw 3 p t 7 p s
1’
2860 Else
2861 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 16 l c r g b " s a n d y b r o w n " l t 1 lw 3 p t 7 p s 1 ’
2862 End I f
2863
2864 Case ( ’ 1 q ’ )
2865 L a y o u t = ’ l i n e s l s 17 ’
2866 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2867
2868 I f ( P r e s e n t ( I n d e x ) ) Then
2869 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e − r e d " l t 1 lw 3 p t 7 p s
1’
2870 Else
2871 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 17 l c r g b " o r a n g e − r e d " l t 1 lw 3 p t 7 p s 1 ’
2872 End I f
2873
201

2874 Case ( ’ 1 r ’ )
2875 L a y o u t = ’ l i n e s l s 18 ’
2876 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2877 I f ( P r e s e n t ( I n d e x ) ) Then
2878 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s p r i n g − g r e e n " l t 1 lw 3 p t 7
ps 1 ’
2879 Else
2880 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 18 l c r g b " s p r i n g − g r e e n " l t 1 lw 3 p t 7 p s 1 ’
2881 End I f
2882
2883 Case ( ’ 1 s ’ )
2884 L a y o u t = ’ l i n e s l s 19 ’
2885 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2886 I f ( P r e s e n t ( I n d e x ) ) Then
2887 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " c y a n " l t 1 lw 3 p t 7 p s 1 ’
2888 Else
2889 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 19 l c r g b " c y a n " l t 1 lw 3 p t 7 p s 1 ’
2890 End I f
2891
2892 Case ( ’ 1 t ’ )
2893 L a y o u t = ’ l i n e s l s 20 ’
2894 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2895 I f ( P r e s e n t ( I n d e x ) ) Then
2896 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " k h a k i " l t 1 lw 3 p t 7 p s 1 ’
2897 Else
2898 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 20 l c r g b " k h a k i " l t 1 lw 3 p t 7 p s 1 ’
2899 End I f
2900
2901 Case ( ’ 1 u ’ )
2902 L a y o u t = ’ l i n e s l s 21 ’
2903 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2904 I f ( P r e s e n t ( I n d e x ) ) Then
2905 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " b i s q u e " l t 1 lw 3 p t 7 p s 1 ’
2906 Else
2907 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 21 l c r g b " b i s q u e " l t 1 lw 3 p t 7 p s 1 ’
2908 End I f
2909
2910 Case ( ’ 1 v ’ )
2911 L a y o u t = ’ l i n e s l s 22 ’
2912 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2913 I f ( P r e s e n t ( I n d e x ) ) Then
2914 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " plum " l t 1 lw 3 p t 7 p s 1 ’
2915 Else
2916 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 22 l c r g b " plum " l t 1 lw 3 p t 7 p s 1 ’
2917 End I f
2918
2919 Case ( ’ 1w ’ )
2920 L a y o u t = ’ l i n e s l s 23 ’
2921 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2922 I f ( P r e s e n t ( I n d e x ) ) Then
2923 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " medium − b l u e " l t 1 lw 3 p t 7 p s
1’
2924 Else
2925 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 23 l c r g b " medium − b l u e " l t 1 lw 3 p t 7 p s 1 ’
2926 End I f
2927
2928 Case ( ’ 1 x ’ )
2929 L a y o u t = ’ l i n e s l s 24 ’
2930 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2931 I f ( P r e s e n t ( I n d e x ) ) Then
2932 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − o r a n g e " l t 1 lw 3 p t 7 p s
1’
2933 Else
2934 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 24 l c r g b " d a r k − o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2935 End I f
2936
2937 Case ( ’ 1 y ’ )
2938 L a y o u t = ’ l i n e s l s 25 ’
2939 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2940 I f ( P r e s e n t ( I n d e x ) ) Then
2941 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − plum " l t 1 lw 3 p t 7 p s 1
202 E. Code of the SampleSource Program


2942 Else
2943 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 25 l c r g b " d a r k − plum " l t 1 lw 3 p t 7 p s 1 ’
2944 End I f
2945
2946 Case ( ’ 1 z ’ )
2947 L a y o u t = ’ l i n e s l s 26 ’
2948 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2949 I f ( P r e s e n t ( I n d e x ) ) Then
2950 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g o l d e n r o d " l t 1 lw 3 p t 7
ps 1 ’
2951 Else
2952 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 26 l c r g b " d a r k − g o l d e n r o d " l t 1 lw 3 p t 7 p s 1 ’
2953 End I f
2954
2955
2956 Case ( ’ 2 a ’ )
2957 Layout = ’ lp l s 1 ’
2958 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2959
2960 Case ( ’ 2 b ’ )
2961 Layout = ’ lp l s 2 ’
2962 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1 ’
2963
2964 Case ( ’ 2 c ’ )
2965 Layout = ’ lp l s 3 ’
2966 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2967
2968 Case ( ’ 2 d ’ )
2969 Layout = ’ lp l s 4 ’
2970 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 2 ’
2971
2972 Case ( ’ 2 e ’ )
2973 Layout = ’ lp l s 5 ’
2974 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " d a r k − r e d " l t 1 lw 2 p t 7 p s 1 ’
2975
2976 Case ( ’ 2 f ’ )
2977 Layout = ’ lp l s 6 ’
2978 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s 1 ’
2979
2980 Case ( ’ 2 g ’ )
2981 Layout = ’ lp l s 7 ’
2982 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " t a n 1 " l t 1 lw 2 p t 7 p s 1 ’
2983
2984 Case ( ’ 2 h ’ )
2985 Layout = ’ lp l s 8 ’
2986 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2987
2988 Case ( ’ 2 i ’ )
2989 Layout = ’ lp l s 9 ’
2990 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2991
2992 Case ( ’ 2 j ’ )
2993 L a y o u t = ’ l p l s 10 ’
2994 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " c h a r t r e u s e " l t 1 lw 2 p t 7 p s 1 ’
2995
2996 Case ( ’ 2 k ’ )
2997 L a y o u t = ’ l p l s 11 ’
2998 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b " d a r k − g o l d e n r o d " l t 1 lw 2 p t 7 p s 1 ’
2999
3000 Case ( ’ 2 l ’ )
3001 L a y o u t = ’ l p l s 12 ’
3002 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
3003
3004 Case ( ’ 2m’ )
3005 L a y o u t = ’ l p l s 13 ’
3006 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " g o l d " l t 1 lw 2 p t 7 p s 1 ’
3007
3008 Case ( ’ 2 n ’ )
3009 L a y o u t = ’ l p l s 13 ’
3010 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 7 p s 2 ’
203

3011
3012 Case ( ’ 2 o ’ )
3013 L a y o u t = ’ l p l s 12 ’
3014 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " web− g r e e n " l t 1 lw 1 p t 7 p s 2 ’
3015
3016
3017 Case ( ’ 3 a ’ )
3018 Layout = ’ p o i n t s l s 1 ’
3019 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 3 p t 6 p s 2 ’
3020
3021 Case ( ’ 3 b ’ )
3022 Layout = ’ p o i n t s l s 2 ’
3023 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 6 p s 2 ’
3024
3025 Case ( ’ 3 c ’ )
3026 Layout = ’ p o i n t s l s 3 ’
3027 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 3 p t 6 p s 2 ’
3028
3029 Case ( ’ 3 d ’ )
3030 Layout = ’ p o i n t s l s 4 ’
3031 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − g r e e n " l t 1 lw 1 p t 6 p s 2 ’
3032
3033 Case ( ’ 3 e ’ )
3034 Layout = ’ p o i n t s l s 5 ’
3035 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " m a g e n t a " l t 1 lw 1 p t 6 p s 2 ’
3036
3037 Case ( ’ 3 f ’ )
3038 Layout = ’ p o i n t s l s 6 ’
3039 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " s a n d y b r o w n " l t 1 lw 1 p t 6 p s 2 ’
3040
3041 Case ( ’ 3 g ’ )
3042 Layout = ’ p o i n t s l s 7 ’
3043 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 6 p s 2 ’
3044
3045 Case ( ’ 3 h ’ )
3046 Layout = ’ p o i n t s l s 8 ’
3047 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " s p r i n g − g r e e n " l t 1 lw 1 p t 6 p s 2 ’
3048
3049 Case ( ’ 3 i ’ )
3050 Layout = ’ p o i n t s l s 9 ’
3051 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " c y a n " l t 1 lw 1 p t 6 p s 2 ’
3052
3053 Case ( ’ 3 j ’ )
3054 L a y o u t = ’ p o i n t s l s 10 ’
3055 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " k h a k i " l t 1 lw 1 p t 6 p s 2 ’
3056
3057 Case ( ’ 3 k ’ )
3058 L a y o u t = ’ p o i n t s l s 11 ’
3059 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b " r e d " l t 1 lw 1 p t 6 p s 2 ’
3060
3061 Case ( ’ 3 l ’ )
3062 L a y o u t = ’ p o i n t s l s 12 ’
3063 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " d a r k − b l u e " l t 1 lw 1 p t 6 p s 2 ’
3064
3065 Case ( ’ 3m’ )
3066 L a y o u t = ’ p o i n t s l s 13 ’
3067 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " r e d " l t 1 lw 1 p t 7 p s 3 ’
3068
3069 Case ( ’ 3 n ’ )
3070 L a y o u t = ’ p o i n t s l s 14 ’
3071 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 14 l c r g b " d a r k − b l u e " l t 1 lw 1 p t 7 p s 3 ’
3072
3073 Case ( ’ 3 o ’ )
3074 L a y o u t = ’ p o i n t s l s 15 ’
3075 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 15 l c r g b " c h a r t r e u s e " l t 1 lw 1 p t 7 p s 3 ’
3076
3077 Case ( ’ 3 p ’ )
3078 L a y o u t = ’ p o i n t s l s 16 ’
3079 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 16 l c r g b " d a r k − g r e e n " l t 1 lw 1 p t 7 p s 3 ’
3080
3081 Case ( ’ 3 q ’ )
204 E. Code of the SampleSource Program

3082 L a y o u t = ’ p o i n t s l s 17 ’
3083 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 17 l c r g b " m a g e n t a " l t 1 lw 1 p t 7 p s 3 ’
3084
3085 Case ( ’ 3 r ’ )
3086 L a y o u t = ’ p o i n t s l s 18 ’
3087 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 18 l c r g b " s a n d y b r o w n " l t 1 lw 1 p t 7 p s 3 ’
3088
3089 Case ( ’ 3 s ’ )
3090 L a y o u t = ’ p o i n t s l s 19 ’
3091 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 19 l c r g b " c y a n " l t 1 lw 1 p t 7 p s 3 ’
3092
3093 Case ( ’ 3 t ’ )
3094 L a y o u t = ’ p o i n t s l s 20 ’
3095 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 20 l c r g b " o r a n g e " l t 1 lw 1 p t 7 p s 3 ’
3096
3097 Case ( ’ 3 u ’ )
3098 L a y o u t = ’ p o i n t s l s 21 ’
3099 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 21 l c r g b " d a r k − v i o l e t " l t 1 lw 1 p t 7 p s 3 ’
3100
3101 Case ( ’ 3 v ’ )
3102 L a y o u t = ’ p o i n t s l s 22 ’
3103 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 22 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 6 p s 2 ’
3104
3105 Case ( ’ 3w ’ )
3106 L a y o u t = ’ p o i n t s l s 23 ’
3107 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 23 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 7 p s 3 ’
3108
3109 Case ( ’ 3 x ’ )
3110 L a y o u t = ’ p o i n t s l s 24 ’
3111 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 24 l c r g b " c h a r t r e u s e " l t 1 lw 3 p t 6 p s 2 ’
3112
3113 Case ( ’ 3 y ’ )
3114 L a y o u t = ’ p o i n t s l s 25 ’
3115 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 25 l c r g b " d a r k − r e d " l t 1 lw 3 p t 6 p s 2 ’
3116
3117 Case ( ’ 3 z ’ )
3118 L a y o u t = ’ p o i n t s l s 26 ’
3119 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 26 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 6 p s 2 ’
3120
3121
3122 Case ( ’ 4 a ’ )
3123 Layout = ’ c i r c l e s l s 1 ’
3124 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " g r a y " lw 3 ’
3125
3126 Case ( ’ 4 b ’ )
3127 Layout = ’ c i r c l e s l s 2 ’
3128 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " r e d " lw 3 ’
3129
3130 Case ( ’ 4 c ’ )
3131 Layout = ’ c i r c l e s l s 3 ’
3132 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " l i g h t − g r e e n " lw 3 ’
3133
3134 Case ( ’ 4 d ’ )
3135 Layout = ’ c i r c l e s l s 4 ’
3136 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " p i n k " lw 3 ’
3137
3138 Case ( ’ 4 e ’ )
3139 Layout = ’ c i r c l e s l s 5 ’
3140 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " d a r k − g r a y " lw 3 ’
3141
3142 Case ( ’ 4 f ’ )
3143 Layout = ’ c i r c l e s l s 6 ’
3144 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b "# d a r k − b l u e " lw 3 ’
3145
3146 Case ( ’ 4 g ’ )
3147 Layout = ’ c i r c l e s l s 7 ’
3148 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " d a r k − y e l l o w " lw 3 ’
3149
3150 Case ( ’ 4 h ’ )
3151 Layout = ’ c i r c l e s l s 8 ’
3152 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " o r a n g e " lw 3 ’
205

3153
3154
3155 Case ( ’ 5 a ’ )
3156 Layout = ’ boxes l s 1 ’
3157 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e s 1 l c r g b " r e d " lw 3 ’
3158
3159 Case ( ’ 5 b ’ )
3160 Layout = ’ boxes l s 2 ’
3161 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e s 2 l c r g b " d a r k − b l u e " lw 3 ’
3162
3163
3164 Case D e f a u l t
3165 W r i t e ( * , ’ (A) ’ ) " Graph S t y l e unknown , p r o c e s s a b o r t e d . "
3166 Return
3167
3168 End S e l e c t
3169
3170 End S u b r o u t i n e
3171
3172 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
3173
3174 End Module S o u r c e M o d u l e

Code/SourceModule.f90
F
Code of the MarsdiepVisual Program
This appendix contains the full code of the MarsdiepVisual program written for this thesis. The code is as used,
which means that it is far from optimized and parts may be present but no longer in use.
1 ! ****************************************************************************
2 ! PROGRAM: MarsdiepVisual
3 !
4 ! PURPOSE : D i f f e r e n t Options are a v a i l a b l e :
5 ! * O p t i o n 1 c r e a t e s p l o t s b a s e d on t h e f l u i d p r o p e r t i e s ( m e a s u r e m e n t s ) .
6 ! * O p t i o n 2 i s b a s e d on t h e ( c a l c u l a t e d ) r e s u l t s o f b o t h l o c a t i o n s . Those
r e s u l t s a r e not c a l c u l a t e d i n t h i s program .
7 ! * O p t i o n 3 i s b a s e d on t h e s i e v e d a t a g a i n e d i n t h e L a b o r a t o r y a t D e l t a r e s
o r on c a l c u l a t i o n s made i n t h e S a m p l e S o u r c e p r o g r a m .
8 ! * O p t i o n 4 i s b a s e d on t h e r e s u l t i n g d a t a from t h e S a m p l e S o u r c e program ,
scenarios option .
9 ! * O p t i o n 5 i s c o m b i n e s f i l e s from t h e d i f f e r e n t s c e n a r i o s i n t o 1 f i l e f o r
all scenarios .
10 ! * O p t i o n 6 i s c r e a t i n g a g r a p h b a s e d on t h e d i f f e r e n t c a l c u l a t e d l o c a t i o n s
and t h e s a m p l e i d e n t i f i c a t i o n r e s u l t s .
11 !
12 ! ****************************************************************************
13
14 Program M a r s d i e p V i s u a l
15
16 Use V i s u a l M o d u l e
17
18 I m p l i c i t None
19
20 ! Variables
21 ! −−−−−−−−−−−−−−−−−−−−−−
22
23 ! Run V a r i a b l e ( s )
24 Integer :: Option
25 Integer :: i , j , k , l , m, I n d e x
26 Integer :: RunOption
27 Integer :: EndOption
28 Integer :: Counter
29 Integer : : WCounter
30
31 ! File Variable ( s )
32 Character (*) , Parameter :: filefolder_in = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramInput \ " ! Inputfiles
33 Character (*) , Parameter :: filefolder_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ " ! O u t p u t f i l e s of t h e SampleSource , used as i n p u t f i l e s f o r t h i s
program .
34
35 Integer :: InputCSV_Sur =1 , S i e v e R e s u l t s =3 , S i e v e R e s u l t s _ V =4 , InputCSV_Sur_DH =5 ,
InputCSV_Sur_T =6 , S i e v e R e s u l t s _ O l d =99 , FormationsTNO =7
36 Integer :: O u t p u t S a m p l e s _ T =21 , OutputSamples_DH =22 , O u t p u t F o r m S i e v e =23 ,
O u t p u t S a m p l e s L o c _ T _ T x t =24 , OutputSamplesLoc_DH_Txt =25 , O u t p u t S a m p l e s L o c _ T x t =27
37 Integer :: F l u i d P r o p T e x = 3 0 , F l u i d P r o p T e x _ T = 3 1 , FluidPropTex_DH = 32
38 Integer :: S a m p l e D a t a = 4 0 , SampleData_T = 4 1 , SampleData_DH = 42
39 Integer :: I n p u t P a r t = 50 , O u t p u t S c e n a r i o s = 51 , O u t p u t S c e n a r i o s 1 = 52 , O u t p u t S c e n ar i o s 2
= 5 3 , O u t p u t S c e n a r i o s 3 = 54
40
41 ! Variables regarding reading of the input f i l e s
42 Integer :: Nlines_sur
43 Character (19) , Allocatable : : DateTime_Sur ( : )

206
207

44 Integer , Allocatable :: J o i nt ( : ) , Btot ( : )


45 Real , Allocatable :: CL ( : ) ,MD( : ) , I n c l i n a t i o n R a w ( : ) , AzimuthRaw ( : )
46 Real , Allocatable :: HS ( : ) , Dip ( : ) , ElevationMGS ( : ) ,R_MGS ( : )
47 Real ( 8 ) , Allocatable :: Away ( : )
48 Real ( 8 ) , Allocatable :: ElevationCalc ( : )
49 Real ( 8 ) , Allocatable :: R_Calc ( : )
50
51 Integer :: Nlines_sur_T
52 Character (19) , Allocatable :: DateTime_Sur_T ( : )
53 Integer , Allocatable :: J o i n t _ T ( : ) , Btot_T ( : )
54 Real , Allocatable :: CL_T ( : ) ,MD_T ( : ) , I n c l i n a t i o n R a w _ T ( : ) , AzimuthRaw_T ( : )
55 Real , Allocatable :: HS_T ( : ) , Dip_T ( : ) , ElevationMGS_T ( : ) ,R_MGS_T ( : )
56 Real ( 8 ) , Allocatable :: Away_T ( : ) , E l e v a t i o n C a l c _ T ( : ) , R_Calc_T ( : )
57
58 Integer :: Nlines_sur_DH
59 Character (19) , Allocatable :: DateTime_Sur_DH ( : )
60 Integer , Allocatable :: J o i n t _ D H ( : ) , Btot_DH ( : )
61 Real , Allocatable :: CL_DH ( : ) ,MD_DH ( : ) , I n c l i n a t i o n R a w _ D H ( : ) , AzimuthRaw_DH ( : )
62 Real , Allocatable :: HS_DH ( : ) , Dip_DH ( : ) , ElevationMGS_DH ( : ) ,R_MGS_DH ( : )
63 Real ( 8 ) , Allocatable :: Away_DH ( : ) , E l e v a t i o n C a l c _ D H ( : ) , R_Calc_DH ( : )
64
65 Character ( : ) , A l l o c a t a b l e : : Sample_ID ( : )
66 ! L e n g t h and number i s v a r i a b l e d e p e n d i n g on t h e l o c a t i o n .
67 Integer : : No_Samples
68
69 Character (10) :: Location
70 Character (50) :: title1 , title2 , title3 , title4 , title0
71 Real ( 8 ) , Allocatable :: PositionBitAll (:)
72 Real , A l l o c a t a b l e : : Temp ( : ) ,EC ( : ) , pH ( : ) ,MF ( : ) , Rho ( : ) , SC ( : )
73 Integer , A l l o c a t a b l e : : RPM_600 ( : ) , RPM_300 ( : ) , RPM_200 ( : ) , RPM_100 ( : ) , RPM_60 ( : ) , RPM_30
( : ) ,RPM_6 ( : ) ,RPM_3 ( : ) , G e l 1 0 s ( : ) , Gel10min ( : )
74 Character (19) , Allocatable : : DateTime_Samples ( : )
75 Character (19) , Allocatable : : DateTimeSamples_T ( : )
76 C h a r a c t e r ( 1 9 ) , A l l o c a t a b l e : : DateTimeSamples_DH ( : )
77 Character ( : ) , A l l o c a t a b l e : : SampleCode_T ( : ) , SampleCode_DH ( : ) ! Length i s
v a r i a b l e d e p e n d i n g on t h e l o c a t i o n .
78 Real , Allocatable : : S a m p l i n g D e p t h T o t _ T ( : ) , SamplingAwayTot_T ( : ) , S a m p l i n g R i g h t T o t _ T
(:)
79 Real , Allocatable : : S o u r c e D e p t h T o t _ T ( : ) , SourceAwayTot_T ( : ) , S o u r c e R i g h t T o t _ T ( : )
80 Real , Allocatable : : SamplingDepthTot_DH ( : ) , SamplingAwayTot_DH ( : ) ,
SamplingRightTot_DH ( : )
81 Real , Allocatable : : SourceDepthTot_DH ( : ) , SourceAwayTot_DH ( : ) , S o u r c e R i g h t T o t _ D H ( : )
82 Character (50) :: Title
83
84 ! Option 1
85 Real , Allocatable :: Alpha_T ( : ) , Alpha_DH ( : )
86 Real , Allocatable :: Delta_BH_T ( : ) , Delta_HB_T ( : ) , Delta_BH_DH ( : ) , Delta_HB_DH ( : )
87 Real , Allocatable :: HB_K_T ( : ) , HB_n_T ( : ) , Yield_HB_T ( : ) ,HB_K_DH ( : ) , HB_n_DH ( : ) , Yield_HB_DH
(:)
88 Real , Allocatable :: PV_T ( : ) , YP_T ( : ) ,PV_DH ( : ) ,YP_DH ( : )
89 Real , Allocatable :: Alpha ( : )
90 Real , Allocatable :: Delta_BH ( : ) , Delta_HB ( : )
91 Real , Allocatable :: HB_K ( : ) , HB_n ( : ) , Yield_HB ( : )
92 Real , Allocatable :: PV ( : ) ,YP ( : )
93
94 Integer : : No_Samples_T , No_Samples_DH
95 Character (19) , Allocatable : : DateTime_Samples_T ( : ) , DateTime_Samples_DH ( : )
96 Character ( : ) , A l l o c a t a b l e : : Sample_ID_T ( : ) , Sample_ID_DH ( : )
97 Real , A l l o c a t a b l e : : Temp_T ( : ) , EC_T ( : ) , pH_T ( : ) ,MF_T ( : ) , Rho_T ( : ) , SC_T ( : )
98 Integer , A l l o c a t a b l e : : RPM_600_T ( : ) , RPM_300_T ( : ) , RPM_200_T ( : ) , RPM_100_T ( : ) , RPM_60_T
( : ) , RPM_30_T ( : ) , RPM_6_T ( : ) , RPM_3_T ( : ) , Gel10s_T ( : ) , Gel10min_T ( : )
99 Real , A l l o c a t a b l e : : Temp_DH ( : ) ,EC_DH ( : ) ,pH_DH ( : ) ,MF_DH ( : ) , Rho_DH ( : ) ,SC_DH ( : )
100 Integer , A l l o c a t a b l e : : RPM_600_DH ( : ) , RPM_300_DH ( : ) , RPM_200_DH ( : ) , RPM_100_DH ( : ) ,
RPM_60_DH ( : ) , RPM_30_DH ( : ) ,RPM_6_DH ( : ) ,RPM_3_DH ( : ) , Gel10s_DH ( : ) , Gel10min_DH ( : )
101
102 Real , A l l o c a t a b l e : : DeltaWBH1 ( : ) , DeltaWBH2 ( : ) , DeltaWHB1 ( : ) , DeltaWHB2 ( : )
103 Character (50) : : Command
104 C h a r a c t e r ( 4 0 ) , A l l o c a t a b l e : : Var_T ( : )
105 C h a r a c t e r ( 4 0 ) , A l l o c a t a b l e : : Var_DH ( : )
106
107 ! Option ( 2 )
208 F. Code of the MarsdiepVisual Program

108 Integer :: ScenarioNo


109
110 ! Option ( 3 )
111 C h a r a c t e r ( 1 4 ) , A l l o c a t a b l e : : Sample_Code ( : ) ! C o n t a i n s c o d e s from b o t h s i d e s s o t h e
s h o r t e r o n e s w i l l h a v e s p a c e s a t t h e end .
112 C h a r a c t e r ( 1 4 ) , A l l o c a t a b l e : : Sample_Code_V ( : )
113 Character (50) :: Graph_Title1
114 Integer :: GraphOption
115 Real , A l l o c a t a b l e : : D ( : , : ) , D_V ( : , : )
116 Real : : Dev
117 Real , A l l o c a t a b l e : : DevTot ( : ) , DevMinTot ( : )
118 Integer :: Index1 , Index2
119 Integer :: MinValPos
120 I n t e g e r , A l l o c a t a b l e : : TempArr ( : )
121
122 Character (50) , Allocatable :: Formation_V ( : )
123 Character (50) , Allocatable :: Formation_Sampling_Time ( : )
124 Character (50) , Allocatable :: Formation_ResultGroup ( : )
125
126 Real , Allocatable :: Char_NA_T ( : ) , Char_NA_DH ( : )
127 Real , Allocatable :: Char_URTY_T ( : ) , Char_URTY_DH ( : )
128 Real , Allocatable :: Char_EE_T ( : ) , Char_EE_DH ( : )
129 Real , Allocatable :: Char_URK_DH ( : )
130 Real , Allocatable :: Char_PZ_DH ( : )
131 Real , Allocatable :: Char_PE_DH ( : )
132 Real , Allocatable :: Char_BX_DH ( : )
133 Real , Allocatable :: Char_AP_DH ( : )
134 Real , Allocatable :: Char_EEBB_T ( : ) , Char_EEBB_DH ( : )
135
136 ! Option 4
137 Character (14) :: ID
138
139 ! Option 5
140 Character (150) :: Filename
141 Character (150) :: Filename_Out
142 Character (150) :: FileContent
143 Character (19) , Allocatable : : DateTimeSamples ( : )
144 Character ( : ) , A l l o c a t a b l e : : SampleCode ( : )
145 C h a r a c t e r ( 4 0 ) , A l l o c a t a b l e : : Var ( : ) ! Reads t h e h e a d e r s and s t o r e s them i n a
v e c t o r , e . g . Var ( 2 ) i s t h e name o f t h e v a l u e s s t o r e d w i t h i n Var2 ( : ) .
146 Real , A l l o c a t a b l e : : Var1 ( : ) , Var2 ( : ) , Var3 ( : ) , Var4 ( : ) , Var5 ( : ) , Var6 ( : ) , Var7 ( : ) , Var8 ( : ) , Var9
( : ) , Var10 ( : ) , Var11 ( : ) , Var12 ( : ) , Var13 ( : ) , Var14 ( : ) , Var15 ( : ) , Var16 ( : ) , Var17 ( : ) , Var18 ( : )
147
148 Real , Allocatable :: Var1_Scenario01 ( : ) , Var1_Scenario02 ( : ) , Var1_Scenario03 ( : ) ,
Var1_Scenario04 (:) , Var1_Scenario05 ( : ) , Var1_Scenario06 ( : ) , Var1_Scenario07 ( : ) ,
Var1_Scenario08 (:) , Var1_Scenario09 ( : )
149 Real , Allocatable :: Var2_Scenario01 ( : ) , Var2_Scenario02 ( : ) , Var2_Scenario03 ( : ) ,
Var2_Scenario04 (:) , Var2_Scenario05 ( : ) , Var2_Scenario06 ( : ) , Var2_Scenario07 ( : ) ,
Var2_Scenario08 (:) , Var2_Scenario09 ( : )
150 Real , Allocatable :: Var3_Scenario01 ( : ) , Var3_Scenario02 ( : ) , Var3_Scenario03 ( : ) ,
Var3_Scenario04 (:) , Var3_Scenario05 ( : ) , Var3_Scenario06 ( : ) , Var3_Scenario07 ( : ) ,
Var3_Scenario08 (:) , Var3_Scenario09 ( : )
151 Real , Allocatable :: Var4_Scenario01 ( : ) , Var4_Scenario02 ( : ) , Var4_Scenario03 ( : ) ,
Var4_Scenario04 (:) , Var4_Scenario05 ( : ) , Var4_Scenario06 ( : ) , Var4_Scenario07 ( : ) ,
Var4_Scenario08 (:) , Var4_Scenario09 ( : )
152 Real , Allocatable :: Var5_Scenario01 ( : ) , Var5_Scenario02 ( : ) , Var5_Scenario03 ( : ) ,
Var5_Scenario04 (:) , Var5_Scenario05 ( : ) , Var5_Scenario06 ( : ) , Var5_Scenario07 ( : ) ,
Var5_Scenario08 (:) , Var5_Scenario09 ( : )
153 Real , Allocatable :: Var6_Scenario01 ( : ) , Var6_Scenario02 ( : ) , Var6_Scenario03 ( : ) ,
Var6_Scenario04 (:) , Var6_Scenario05 ( : ) , Var6_Scenario06 ( : ) , Var6_Scenario07 ( : ) ,
Var6_Scenario08 (:) , Var6_Scenario09 ( : )
154 Real , Allocatable :: Var7_Scenario01 ( : ) , Var7_Scenario02 ( : ) , Var7_Scenario03 ( : ) ,
Var7_Scenario04 (:) , Var7_Scenario05 ( : ) , Var7_Scenario06 ( : ) , Var7_Scenario07 ( : ) ,
Var7_Scenario08 (:) , Var7_Scenario09 ( : )
155 Real , Allocatable :: Var8_Scenario01 ( : ) , Var8_Scenario02 ( : ) , Var8_Scenario03 ( : ) ,
Var8_Scenario04 (:) , Var8_Scenario05 ( : ) , Var8_Scenario06 ( : ) , Var8_Scenario07 ( : ) ,
Var8_Scenario08 (:) , Var8_Scenario09 ( : )
156 Real , Allocatable :: Var9_Scenario01 ( : ) , Var9_Scenario02 ( : ) , Var9_Scenario03 ( : ) ,
Var9_Scenario04 (:) , Var9_Scenario05 ( : ) , Var9_Scenario06 ( : ) , Var9_Scenario07 ( : ) ,
Var9_Scenario08 (:) , Var9_Scenario09 ( : )
157
209

158 Real , Allocatable : : Var10_Scenario01 ( : ) , Var10_Scenario02 ( : ) , Var10_Scenario03 ( : ) ,


Var10_Scenario04 ( : ) , Var10_Scenario05 ( : ) , Var10_Scenario06 ( : ) , Var10_Scenario07 ( : ) ,
Var10_Scenario08 ( : ) , Var10_Scenario09 ( : )
159 Real , Allocatable : : Var11_Scenario01 ( : ) , Var11_Scenario02 ( : ) , Var11_Scenario03 ( : ) ,
Var11_Scenario04 ( : ) , Var11_Scenario05 ( : ) , Var11_Scenario06 ( : ) , Var11_Scenario07 ( : ) ,
Var11_Scenario08 ( : ) , Var11_Scenario09 ( : )
160 Real , Allocatable : : Var12_Scenario01 ( : ) , Var12_Scenario02 ( : ) , Var12_Scenario03 ( : ) ,
Var12_Scenario04 ( : ) , Var12_Scenario05 ( : ) , Var12_Scenario06 ( : ) , Var12_Scenario07 ( : ) ,
Var12_Scenario08 ( : ) , Var12_Scenario09 ( : )
161 Real , Allocatable : : Var13_Scenario01 ( : ) , Var13_Scenario02 ( : ) , Var13_Scenario03 ( : ) ,
Var13_Scenario04 ( : ) , Var13_Scenario05 ( : ) , Var13_Scenario06 ( : ) , Var13_Scenario07 ( : ) ,
Var13_Scenario08 ( : ) , Var13_Scenario09 ( : )
162 Real , Allocatable : : Var14_Scenario01 ( : ) , Var14_Scenario02 ( : ) , Var14_Scenario03 ( : ) ,
Var14_Scenario04 ( : ) , Var14_Scenario05 ( : ) , Var14_Scenario06 ( : ) , Var14_Scenario07 ( : ) ,
Var14_Scenario08 ( : ) , Var14_Scenario09 ( : )
163 Real , Allocatable : : Var15_Scenario01 ( : ) , Var15_Scenario02 ( : ) , Var15_Scenario03 ( : ) ,
Var15_Scenario04 ( : ) , Var15_Scenario05 ( : ) , Var15_Scenario06 ( : ) , Var15_Scenario07 ( : ) ,
Var15_Scenario08 ( : ) , Var15_Scenario09 ( : )
164 Real , Allocatable : : Var16_Scenario01 ( : ) , Var16_Scenario02 ( : ) , Var16_Scenario03 ( : ) ,
Var16_Scenario04 ( : ) , Var16_Scenario05 ( : ) , Var16_Scenario06 ( : ) , Var16_Scenario07 ( : ) ,
Var16_Scenario08 ( : ) , Var16_Scenario09 ( : )
165 Real , Allocatable : : Var17_Scenario01 ( : ) , Var17_Scenario02 ( : ) , Var17_Scenario03 ( : ) ,
Var17_Scenario04 ( : ) , Var17_Scenario05 ( : ) , Var17_Scenario06 ( : ) , Var17_Scenario07 ( : ) ,
Var17_Scenario08 ( : ) , Var17_Scenario09 ( : )
166 Real , Allocatable : : Var18_Scenario01 ( : ) , Var18_Scenario02 ( : ) , Var18_Scenario03 ( : ) ,
Var18_Scenario04 ( : ) , Var18_Scenario05 ( : ) , Var18_Scenario06 ( : ) , Var18_Scenario07 ( : ) ,
Var18_Scenario08 ( : ) , Var18_Scenario09 ( : )
167
168 ! Option 6
169 Character (100) , Allocatable :: Fm ( : )
170 Integer , Allocatable :: Fm_No ( : )
171 Character (150) , Allocatable :: Filenames ( : )
172 Character (50) :: BackgroundName
173
174 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
175
176 W r i t e ( * , ’ (A) ’ ) " T h i s p r o g r a m i s meant f o r v i s u a l i s a t i o n o f raw d a t a and d a t a c a l c u l a t e d
elsewhere . "
177
178 100 C o n t i n u e ! A l l o w s f o r a c a l l from t h e end o f t h e p r o g r a m i n o r d e r t o e n a b l e r u n s
of t h e d i f f e r e n t p a r t s w i t h o u t e x i t i n g t h e program .
179
180 W r i t e ( * , ’ (A) ’ ) " Give an o p t i o n o r ’ 0 ’ f o r a l i s t o f o p t i o n s : "
181 Read ( * , ’ ( I ) ’ ) Option
182 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
183
184 S e l e c t Case ( O p t i o n )
185
186 Case ( 0 )
187 Write ( * , * )
188 W r i t e ( * , ’ (A) ’ ) " O p t i o n 1 c r e a t e s p l o t s b a s e d on t h e f l u i d p r o p e r t i e s ( m e a s u r e m e n t s ) . "
189 W r i t e ( * , ’ (A) ’ ) " O p t i o n 2 i s b a s e d on t h e ( c a l c u l a t e d ) r e s u l t s o f b o t h l o c a t i o n s . Those
r e s u l t s a r e not c a l c u l a t e d i n t h i s program . "
190 W r i t e ( * , ’ (A) ’ ) " O p t i o n 3 i s b a s e d on t h e s i e v e d a t a g a i n e d i n t h e L a b o r a t o r y a t D e l t a r e s
o r on c a l c u l a t i o n s made i n t h e S a m p l e S o u r c e p r o g r a m . "
191 W r i t e ( * , ’ (A) ’ ) " O p t i o n 4 i s b a s e d on t h e r e s u l t i n g d a t a from t h e S a m p l e S o u r c e program ,
scenarios option . "
192 W r i t e ( * , ’ (A) ’ ) " O p t i o n 5 i s c o m b i n e s f i l e s from t h e d i f f e r e n t s c e n a r i o s i n t o 1 f i l e f o r
all scenarios . "
193 W r i t e ( * , ’ (A) ’ ) " O p t i o n 6 i s c r e a t i n g a g r a p h b a s e d on t h e d i f f e r e n t c a l c u l a t e d l o c a t i o n s
and t h e s a m p l e i d e n t i f i c a t i o n r e s u l t s . "
194 Write ( * , * )
195 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
196 Go t o 100
197
198 Case ( 1 )
199
200 Counter = 0
201
210 F. Code of the MarsdiepVisual Program

202 200 C o n t i n u e
203
204 I f ( C o u n t e r < 2 ) Then
205
206 I f ( C o u n t e r == 0 ) Then
207 L o c a t i o n = ’T ’
208 E l s e I f ( C o u n t e r == 1 ) Then
209 L o c a t i o n = ’DH’
210 End I f
211
212 S e l e c t Case ( L o c a t i o n )
213
214 Case ( ’ Den H e l d e r ’ , ’ den h e l d e r ’ , ’ dh ’ , ’DH’ , ’Dh ’ )
215 Location = ’ Den H e l d e r ’
216 W r i t e ( * , ’ (A, A) ’ ) " The l o c a t i o n i s " , t r i m ( L o c a t i o n )
217 Open ( InputCSV_Sur , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_DH_Total . csv " ) !
A l l s u r v e y d a t a , from DH, combined i n t o one f i l e .
218 Open ( SampleData , f i l e = f i l e f o l d e r _ i n / / " SampleData_DH . c s v " )
219 Open ( F l u i d P r o p T e x , f i l e = f i l e f o l d e r _ o u t / / " F u l l 0 1 − 03/
DH_FluidPropTex_Scenario_01 . t x t " )
220
221 title1 = ’ Den_Helder_Drilled_Paths ’
222
223 Case ( ’ T e x e l ’ , ’ t e x e l ’ , ’ t x l ’ , ’TXL ’ , ’ t ’ , ’T ’ )
224 Location = ’ Texel ’
225 W r i t e ( * , ’ (A, A) ’ ) " The l o c a t i o n i s " , t r i m ( L o c a t i o n )
226 Open ( InputCSV_Sur , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_Texel_Total . csv " ) !
A l l s u r v e y d a t a , from T e x e l , combined i n t o one f i l e .
227 Open ( SampleData , f i l e = f i l e f o l d e r _ i n / / " SampleData_Texel . csv " )
228 Open ( F l u i d P r o p T e x , f i l e = f i l e f o l d e r _ o u t / / " F u l l 0 1 − 03/ T _ F l u i d P r o p T e x _ S c e n a r i o _ 0 1
. txt ")
229
230 title1 = ’ Texel_Drilled_Paths ’
231
232 End S e l e c t
233
234 title0 = trim ( short ( Location ) ) // ’ Drilled Paths ’
235 title2 = trim ( short ( Location ) ) // ’ Rheologic Data ’
236 title3 = trim ( short ( Location ) ) // ’ D e n s i t y v s . Sand C o n t e n t ’
237 title4 = trim ( short ( Location ) ) // ’ T e m p e r a t u r e v s . Marsh F u n n e l ’
238
239 C a l l R e a d i n g F i l e C S V _ S u r ( InputCSV_Sur , N l i n e s _ s u r , DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w ,
AzimuthRaw , B t o t , Dip , E l e v a t i o n C a l c , ElevationMGS , Away , R_Calc , R_MGS)
240 C a l l R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , SampleData , No_Samples , DateTime_Samples , Sample_ID , Temp
, EC , pH , MF, Rho , SC , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s ,
Gel10min )
241 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , F l u i d P r o p T e x , Var , SampleCode , DateTimeSamples , Yield_HB ,
HB_K , HB_n , Alpha , Delta_HB , PV , YP , Delta_BH , DeltaWBH1 , DeltaWBH2 , DeltaWHB1 ,
DeltaWHB2 )
242
243
244 ! Main O p t i o n 1
245 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
246 C a l l f2gp3D ( L o c a t i o n , Away , R_Calc , E l e v a t i o n C a l c , t i t l e 1 , ’Away [m] ’ , ’ R_{ C a l c u l a t e d } [m] ’ , ’
E l e v a t i o n [m] ’ , t i t l e 0 )
247 ! ( l o c a t i o n , x , y , z , f i l e n a m e , x− a x i s t i t l e , y− a x i s t i t l e , z − a x i s t i t l e , t i t l e )
248
249 C a l l f 2 g p R h D a t a ( L o c a t i o n , Sample_ID , RPM_600 , ’ 3 a ’ , RPM_300 , ’ 3 b ’ , RPM_200 , ’ 3 c ’ , RPM_100 , ’ 3 d ’ ,
RPM_60 , ’ 3 e ’ , RPM_30 , ’ 3 f ’ , RPM_6 , ’ 3 g ’ , RPM_3 , ’ 3 h ’ , Gel10s , ’ 3 i ’ , Gel10min , ’ 3 j ’ , t i t l e 2 , ’ S a m p l e s ’ ,
’ R e a d i n g s [ { \ 2 6 0 } ] ’ , ’RPM_{600} ’ , ’RPM_{300} ’ , ’RPM_{200} ’ , ’RPM_{100} ’ , ’RPM_{60} ’ , ’RPM_{30} ’
, ’RPM_{6} ’ , ’RPM_{3} ’ , ’ G e l 1 0 s ’ , ’ Gel10min ’ )
250 ! ( L o c a t i o n , x , y1 , y2 , y3 , y4 , y5 , y6 , y7 , y8 , t i t l e , x − a x i s t i t l e , y − a x i s t i t l e ,
graph_title1 , graph_title2 , graph_title3 , graph_title4 , graph_title5 , graph_title6 ,
graph_title7 , graph_title8 )
251
252 C a l l f 2 g p S a m p l e P a r ( L o c a t i o n , Sample_ID , Rho , ’ 3 a ’ , SC , ’ 3 b ’ , t i t l e 3 , ’ S a m p l e s ’ , ’ D e n s i t y [ kg /m^ 3 ]
’ , ’ P e r c e n t a g e [%] ’ , ’ D e n s i t y ’ , ’ Sand C o n t e n t ’ )
253
254 C a l l f 2 g p D a t a ( L o c a t i o n , ’ Y i e l d _ S t r e s s ’ , ’ Y i e l d S t r e s s ’ , ’ Sample Code ’ , ’ Y i e l d S t r e s s [ Pa ] ’ ,
SampleCode , Yield_HB , ’HB Tau Y i e l d ’ , ’ 3 a ’ ,YP , ’YP ’ , ’ 3 b ’ )
255
211

256 ! C a l l f 2 g p D a t a ( L o c a t i o n , ’ B e s t _ F i t ’ , ’ B e s t F i t ’ , ’ Sample Code ’ , ’ D e v i a t i o n ’ , SampleCode ,


Delta_HB , ’ D e l t a HB’ , ’ 3 k ’ , Delta_BH , ’ D e l t a BH’ , ’ 3 l ’ )
257
258 C a l l f2gpYPData ( L o c a t i o n , ’ B e s t _ F i t _ Y P ’ , ’ B e s t F i t ’ , ’ Sample Code ’ , ’ D e v i a t i o n [ − ] ’ ,
SampleCode , Delta_HB , ’ D e v i a t i o n HB ’ , ’ 3x ’ , Delta_BH , ’ D e v i a t i o n BH ’ , ’ 3 k ’ , Yield_HB , ’HB Y i e l d
S t r e s s ’ , ’ 3 v ’ ,YP , ’BH Y i e l d S t r e s s ’ , ’ 3 y ’ )
259
260 C a l l f2gpYPData ( L o c a t i o n , ’ Best_Fit_YP_W1 ’ , ’ B e s t F i t W1’ , ’ Sample Code ’ , ’ D e v i a t i o n [ − ] ’ ,
SampleCode , DeltaWHB1 , ’ D e v i a t i o n HB ’ , ’ 3 x ’ , DeltaWBH1 , ’ D e v i a t i o n BH ’ , ’ 3 k ’ , Yield_HB , ’HB Y i e l d
S t r e s s ’ , ’ 3 v ’ ,YP , ’BH Y i e l d S t r e s s ’ , ’ 3 y ’ )
261
262 C a l l f2gpYPData ( L o c a t i o n , ’ Best_Fit_YP_W2 ’ , ’ B e s t F i t W2’ , ’ Sample Code ’ , ’ D e v i a t i o n [ − ] ’ ,
SampleCode , DeltaWHB2 , ’ D e v i a t i o n HB ’ , ’ 3 x ’ , DeltaWBH2 , ’ D e v i a t i o n BH ’ , ’ 3 k ’ , Yield_HB , ’HB Y i e l d
S t r e s s ’ , ’ 3 v ’ ,YP , ’BH Y i e l d S t r e s s ’ , ’ 3 y ’ )
263
264 ! C a l l f 2 g p D a t a ( L o c a t i o n , ’ Comparison ’ , ’ Comparison ’ , ’ Sample Code ’ , ’ Y i e l d S t r e s s [ Pa ] ’ ,
SampleCode , Yield_HB , ’HB Tau Y i e l d ’ , ’ 3 a ’ , YP , ’ YP ’ , ’ 3 b ’ , Rho , ’ D e n s i t y [ kg /m^ 3 ] ’ , ’ 3 c ’ , SC , ’ Sand
Content [%] ’ , ’3d ’ )
265
266 ! C a l l f 2 g p D a t a ( L o c a t i o n , ’ Comparison_2 ’ , ’ C o m p a r i s o n 2 ’ , ’ Sample Code ’ , ’ Y i e l d S t r e s s [ Pa ] ’ ,
SampleCode , Rho , ’ D e n s i t y [ kg /m^ 3 ] ’ , ’ 3 c ’ , SC , ’ Sand C o n t e n t [ % ] ’ , ’ 3 d ’ )
267
268 ! C a l l f 2 g p D a t a M u l t i ( L o c a t i o n , ’ Comparison_3 ’ , ’ Comparison ’ , ’ D e n s i t y v s . Sand C o n t e n t ’ , ’
Y i e l d S t r e s s v s . D e l t a ’ , ’ Sample_Code ’ , ’ D e n s i t y [ kg /m^ 3 ] ’ , ’ Sand C o n t e n t [ % ] ’ , ’ Y i e l d S t r e s s
[ Pa ] ’ , ’ D e l t a [ − ] ’ , SampleCode_DH , Rho , ’ D e n s i t y [ kg /m^ 3 ] ’ , ’ 3 c ’ , SC , ’ Sand C o n t e n t [ % ] ’ , ’ 3 d ’ ,
HB_Tau_Yield , ’HB Tau Y i e l d ’ , ’ 3 a ’ , YP , ’ YP ’ , ’ 3 b ’ , Delta_BH_T , ’ D e l t a BH’ , ’ ’ , Delta_HB_T , ’ ’ , ’ ’ , )
269
270 E l s e I f ( C o u n t e r == 2 ) Then
271
272 Open ( F l u i d P r o p T e x _ T , f i l e = f i l e f o l d e r _ o u t / / " T_FluidPropTex_Scenario_01 . t x t " )
273 Open ( FluidPropTex_DH , f i l e = f i l e f o l d e r _ o u t / / " DH_FluidPropTex_Scenario_01 . t x t " )
274 Open ( SampleData_T , f i l e = f i l e f o l d e r _ i n / / " SampleData_Texel . csv " )
275 Open ( SampleData_DH , f i l e = f i l e f o l d e r _ i n / / " SampleData_DH . c s v " )
276
277 Location = ’ Texel ’
278 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , F l u i d P r o p T e x _ T , Var_T , SampleCode_T , DateTimeSamples_T ,
Yield_HB_T , HB_K_T , HB_n_T , Alpha_T , Delta_HB_T , PV_T , YP_T , Delta_BH_T )
279 C a l l R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , SampleData_T , No_Samples_T , DateTime_Samples_T ,
Sample_ID_T , Temp_T , EC_T , pH_T , MF_T , Rho_T , SC_T , RPM_600_T , RPM_300_T , RPM_200_T , RPM_100_T ,
RPM_60_T , RPM_30_T , RPM_6_T , RPM_3_T , Gel10s_T , Gel10min_T )
280
281 L o c a t i o n = ’ Den H e l d e r ’
282 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , FluidPropTex_DH , Var_DH , SampleCode_DH ,
DateTimeSamples_DH , Yield_HB_DH , HB_K_DH, HB_n_DH , Alpha_DH , Delta_HB_DH , PV_DH , YP_DH ,
Delta_BH_DH )
283 C a l l R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , SampleData_DH , No_Samples_DH , DateTime_Samples_DH ,
Sample_ID_DH , Temp_DH , EC_DH , pH_DH , MF_DH, Rho_DH , SC_DH , RPM_600_DH , RPM_300_DH , RPM_200_DH ,
RPM_100_DH , RPM_60_DH , RPM_30_DH , RPM_6_DH , RPM_3_DH , Gel10s_DH , Gel10min_DH )
284
285 C a l l f 2 g p D a t a M u l t i 2 ( ’ F l u i d _ C o m p a r i s o n ’ , ’ F l u i d C o m p a r i s o n ’ , ’ D e n s i t y v s . Sand C o n t e n t ’ , ’
Y i e l d S t r e s s v s . D e v i a t i o n ’ , ’ Sample Code ’ , ’ D e n s i t y [ kg /m^ 3 ] ’ , ’ Sand C o n t e n t [%] ’ , ’ Y i e l d
S t r e s s [ Pa ] ’ , ’ S c a l e d D e v i a t i o n [ − ] ’ , SampleCode_T , SampleCode_DH , Rho_T , Rho_DH , ’ D e n s i t y
R e t u r n Flow ’ , ’ 3m’ , SC_T , SC_DH , ’ Sand C o n t e n t ’ , ’ 3 n ’ , YP_T , YP_DH , ’ Y i e l d S t r e s s Bingham ’ , ’ 3 t ’ ,
Yield_HB_T , Yield_HB_DH , ’ Y i e l d S t r e s H e r s c h e l − B u l k l e y ’ , ’ 3 v ’ , Delta_BH_T , Delta_BH_DH , ’
D e v i a t i o n Bingham ’ , ’ 3w ’ , Delta_HB_T , Delta_HB_DH , ’ D e v i a t i o n H e r s c h e l − B u l k l e y ’ , ’ 3 x ’ )
286
287 C a l l f 2 g p D a t a H i s t o ( ’ D e v i a t i o n from D a t a ’ , ’ Sample Code ’ , ’ D e v i a t i o n [ − ] ’ , SampleCode_T ,
Delta_BH_T , Delta_HB_T , ’ T e x e l ’ , ’ 5 a ’ , SampleCode_DH , Delta_BH_DH , Delta_BH_T , ’ Den H e l d e r ’ , ’ 5 b ’
)
288
289 End I f
290
291 ! Closing t h i s Option
292 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
293 I f ( C o u n t e r < 2 ) Then
294 C l o s e ( InputCSV_Sur )
295 Close ( SampleData )
296 C l o s e ( SampleData_T )
297 C l o s e ( SampleData_DH )
298 Close ( FluidPropTex )
299 D e a l l o c a t e ( DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w , AzimuthRaw , B t o t , Dip , E l e v a t i o n C a l c ,
212 F. Code of the MarsdiepVisual Program

ElevationMGS , Away , R_Calc , R_MGS)


300 D e a l l o c a t e ( DateTime_Samples , Sample_ID , Temp , EC , pH , MF, Rho , SC , RPM_600 , RPM_300 , RPM_200 ,
RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s , Gel10min )
301 D e a l l o c a t e ( Var , SampleCode , DateTimeSamples , Yield_HB , HB_K , HB_n , Alpha , Delta_HB , PV ,
YP , Delta_BH )
302 D e a l l o c a t e ( DeltaWBH1 , DeltaWBH2 , DeltaWHB1 , DeltaWHB2 )
303 E l s e I f ( C o u n t e r == 2 ) Then
304 C l o s e ( SampleData_T )
305 C l o s e ( SampleData_DH )
306 Close ( FluidPropTex_T )
307 C l o s e ( FluidPropTex_DH )
308 D e a l l o c a t e ( Var_T , SampleCode_T , DateTime_Samples_T , Sample_ID_T , Temp_T , EC_T , pH_T , MF_T ,
Rho_T , SC_T , RPM_600_T , RPM_300_T , RPM_200_T , RPM_100_T , RPM_60_T , RPM_30_T , RPM_6_T , RPM_3_T ,
Gel10s_T , Gel10min_T )
309 D e a l l o c a t e ( Var_DH , SampleCode_DH , DateTime_Samples_DH , Sample_ID_DH , Temp_DH , EC_DH , pH_DH ,
MF_DH, Rho_DH , SC_DH , RPM_600_DH , RPM_300_DH , RPM_200_DH , RPM_100_DH , RPM_60_DH , RPM_30_DH ,
RPM_6_DH , RPM_3_DH , Gel10s_DH , Gel10min_DH )
310 End I f
311
312 Counter = Counter + 1
313
314 I f ( C o u n t e r <= 2 ) Then
315 W r i t e ( * , ’ (A, I ) ’ ) " Counter i s " , Counter
316 Write ( * , * )
317 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
318 Go To 200
319 End I f
320
321 Case ( 2 )
322
323 W r i t e ( * , ’ (A) ’ ) " Give t h e o p t i o n f o r t h e g r a p h on t o p o f t h e c r o s s − s e c t i o n , e i t h e r ’ 1 ’ (
Head L o c a t i o n s a t S a m p l i n g Time ) , ’ 2 ’ ( C a l c u l a t e d s a m p l e s o u r c e ) , ’ 3 ’ ( D r i l l e d P a t h s ) ,
’4 ’ ( Option 1 + 3) , ’5 ’ ( Option 2 + 3) or ’10 ’ ( All of t h e above ) : "
324 Read ( * , ’ ( I ) ’ ) GraphOption
325
326 Write ( * , * )
327 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
328 Write ( * , * )
329
330 ScenarioNo = 5
331
332 Open ( InputCSV_Sur_DH , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_DH_Total . csv " )
333 Open ( InputCSV_Sur_T , f i l e = f i l e f o l d e r _ i n / / " InputData_Sur_Texel_Total . csv " )
334
335 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " T_OutputSamples_Scenario_ " , ScenarioNo , " . csv "
336 Open ( O u t p u t S a m p l e s _ T , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
337
338 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " T _ O u t p u t S a m p l e s L o c _ S c e n a r i o _ " , S c e n a r i o N o , " . t x t "
339 Open ( O u t p u t S a m p l e s L o c _ T _ T x t , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
340
341 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " DH_OutputSamples_Scenario_ " , ScenarioNo , " . csv "
342 Open ( OutputSamples_DH , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
343
344 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " D H _ O u t p u t S a m p l e s L o c _ S c e n a r i o _ " , S c e n a r i o N o , " . t x t "
345 Open ( OutputSamplesLoc_DH_Txt , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
346
347 Location = ’ Texel ’
348
349 C a l l R e a d i n g F i l e O u t p u t S a m p l e s L o c T x t ( L o c a t i o n , O u t p u t S a m p l e s L o c _ T _ T x t , SampleCode_T ,
DateTimeSamples_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T , S a m p l i n g R i g h t T o t _ T , SourceAwayTot_T
, SourceDepthTot_T , SourceRightTot_T )
350
351 Location = ’ Den H e l d e r ’
352
353 C a l l R e a d i n g F i l e O u t p u t S a m p l e s L o c T x t ( L o c a t i o n , OutputSamplesLoc_DH_Txt , SampleCode_DH ,
DateTimeSamples_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , SamplingRightTot_DH ,
SourceAwayTot_DH , SourceDepthTot_DH , S o u r c e R i g h t T o t _ D H )
354
355 C a l l R e a d i n g F i l e C S V _ S u r ( InputCSV_Sur_T , N l i n e s _ s u r _ T , DateTime_Sur_T , J o i n t _ T , CL_T , MD_T,
213

I n c l i n a t i o n R a w _ T , AzimuthRaw_T , Btot_T , Dip_T , E l e v a t i o n C a l c _ T , ElevationMGS_T , Away_T , R_Calc_T


, R_MGS_T )
356
357 C a l l R e a d i n g F i l e C S V _ S u r ( InputCSV_Sur_DH , N l i n e s _ s u r _ D H , DateTime_Sur_DH , Joint_DH , CL_DH ,
MD_DH, I n c l i n a t i o n R a w _ D H , AzimuthRaw_DH , Btot_DH , Dip_DH , E l e v a t i o n C a l c _ D H , ElevationMGS_DH ,
Away_DH , R_Calc_DH , R_MGS_DH)
358
359 ! Main O p t i o n 2
360 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
361 S e l e c t Case ( G r a p h O p t i o n )
362
363 Case ( 1 )
364 filename = ’ Head_Location_at_Sampling_Time ’
365 title = ’ Head L o c a t i o n a t S a m p l i n g Time ’
366 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
367
368 Case ( 2 )
369 filename = ’ Sample_Source_Locations ’
370 title = ’ Sample S o u r c e L o c a t i o n s ’
371 C a l l f2gpwBG ( SampleCode_T , SourceAwayTot_T , S o u r c e D e p t h T o t _ T , ’ 3 k ’ , SampleCode_DH ,
SourceAwayTot_DH , SourceDepthTot_DH , ’ 3 l ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s
T e x e l ’ , ’ S a m p l e s Den H e l d e r ’ )
372
373 Case ( 3 )
374 filename = ’ Drilled_Paths ’
375 title = ’ Drilled Paths ’
376 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 k ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 l ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
377
378 Case ( 4 )
379 filename = ’ Drilled_Paths_and_Head_Location_at_Sampling_Time ’
380 title = ’ D r i l l e d P a t h s and Head L o c a t i o n a t S a m p l i n g Time ’
381 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
382
383 Case ( 5 )
384 W r i t e ( * , ’ (A) ’ ) " To Be Done . . . "
385 ! title = ’ D r i l l e d P a t h s and Sample S o u r c e L o c a t i o n s ’
386 ! C a l l f2gpwBG2 ( G r a p h O p t i o n , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T , ’ 3 l ’ ,
Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 k ’ ,
Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
387
388 Case ( 6 )
389 title = ’ F o r m a t i o n s TNO ’
390 C a l l f2gpwBG ( SampleCode_T , SourceAwayTot_T , S o u r c e D e p t h T o t _ T , ’ 3 k ’ , SampleCode_DH ,
SourceAwayTot_DH , SourceDepthTot_DH , ’ 3 l ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s
T e x e l ’ , ’ S a m p l e s Den H e l d e r ’ )
391
392 Case ( 1 0 )
393 filename = ’ Head_Location_at_Sampling_Time ’
394 title = ’ Head L o c a t i o n a t S a m p l i n g Time ’
395 GraphOption = 1
396 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
397
398 title = ’ Sample S o u r c e L o c a t i o n s ’
399 GraphOption = 2 ! Has no e f f e c t s i n c e i t c a l l s a d i f f e r e n t
s u b r o u t i n e t h a t h a s y e t t o be merged w i t h t h e f2gpbw2 s u b r o u t i n e . TO BE DONE .
400 C a l l f2gpwBG ( SampleCode_T , SourceAwayTot_T , S o u r c e D e p t h T o t _ T , ’ 3 k ’ , SampleCode_DH ,
SourceAwayTot_DH , SourceDepthTot_DH , ’ 3 l ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s
T e x e l ’ , ’ S a m p l e s Den H e l d e r ’ )
214 F. Code of the MarsdiepVisual Program

401
402 filename = ’ Drilled_Paths ’
403 title = ’ Drilled Paths ’
404 GraphOption = 3
405 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
406
407 filename = ’ Drilled_Paths_and_Head_Location_at_Sampling_Time ’
408 title = ’ D r i l l e d P a t h s and Head L o c a t i o n a t S a m p l i n g Time ’
409 GraphOption = 4
410 C a l l f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , SampleCode_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
’ 3 k ’ , Away_T , E l e v a t i o n C a l c _ T , ’ 1 a ’ , SampleCode_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , ’ 3 l
’ , Away_DH , E l e v a t i o n C a l c _ D H , ’ 1 b ’ , t i t l e , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ , ’ S a m p l e s T e x e l ’ , ’
S a m p l e s Den H e l d e r ’ , ’ D r i l l e d P a t h s T e x e l ’ , ’ D r i l l e d P a t h s Den H e l d e r ’ )
411
412 End S e l e c t
413
414 ! F i l e s f o r Hans − c o n t a i n i n g t h e l o c a t i o n o f t h e s a m p l e s i n t a b l e s
415 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
416 Open ( 1 0 , F i l e = f i l e f o l d e r _ o u t / / " L o c a t i o n S a m p l e T i m e _ T . c s v " )
417 W r i t e ( 1 0 , ’ (A) ’ ) ’ T e x e l ’
418 W r i t e ( 1 0 , ’ ( 7 (A) ) ’ ) " Sample Code " , " ; " , "Away [m] " , " ; " , " Depth [m] " , " ; " , " R i g h t [m] "
419 Do i = 1 , s i z e ( SampleCode_T )
420 W r i t e ( 1 0 , ’ (A, 3 ( A, F7 . 2 ) ) ’ ) SampleCode_T ( i ) , " ; " , SamplingAwayTot_T ( i ) , " ; " ,
SamplingDepthTot_T ( i ) , " ; " , SamplingRightTot_T ( i )
421 End Do
422 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
423
424 Open ( 1 0 , F i l e = f i l e f o l d e r _ o u t / / " LocationSampleTime_DH . c s v " )
425 W r i t e ( 1 0 , ’ (A) ’ ) ’ Den H e l d e r ’
426 W r i t e ( 1 0 , ’ ( 7 (A) ) ’ ) " Sample Code " , " ; " , "Away [m] " , " ; " , " Depth [m] " , " ; " , " R i g h t [m] "
427
428 Do i = 1 , s i z e ( SampleCode_DH )
429 W r i t e ( 1 0 , ’ (A, 3 ( A, F7 . 2 ) ) ’ ) SampleCode_DH ( i ) , " ; " , SamplingAwayTot_DH ( i ) , " ; " ,
SamplingDepthTot_DH ( i ) , " ; " , S a m p l i n g R i g h t T o t _ D H ( i )
430 End Do
431 C l o s e ( 1 0 , S t a t u s = ’KEEP ’ )
432 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
433
434 ! Closing t h i s Option
435
436 Close ( OutputSamples_T )
437 C l o s e ( OutputSamples_DH )
438 Close ( OutputSamplesLoc_T_Txt )
439 C l o s e ( OutputSamplesLoc_DH_Txt )
440 C l o s e ( InputCSV_Sur_DH )
441 C l o s e ( InputCSV_Sur_T )
442
443 D e a l l o c a t e ( DateTimeSamples_T , SampleCode_T , S a m p l i n g D e p t h T o t _ T , SamplingAwayTot_T ,
S a m p l i n g R i g h t T o t _ T , S o u r c e D e p t h T o t _ T , SourceAwayTot_T , S o u r c e R i g h t T o t _ T )
444 D e a l l o c a t e ( DateTimeSamples_DH , SampleCode_DH , SamplingDepthTot_DH , SamplingAwayTot_DH ,
SamplingRightTot_DH , SourceDepthTot_DH , SourceAwayTot_DH , S o u r c e R i g h t T o t _ D H )
445 D e a l l o c a t e ( DateTime_Sur_T , J o i n t _ T , CL_T , MD_T, I n c l i n a t i o n R a w _ T , AzimuthRaw_T , Btot_T , Dip_T ,
E l e v a t i o n C a l c _ T , ElevationMGS_T , Away_T , R_Calc_T , R_MGS_T )
446 D e a l l o c a t e ( DateTime_Sur_DH , Joint_DH , CL_DH ,MD_DH, I n c l i n a t i o n R a w _ D H , AzimuthRaw_DH , Btot_DH ,
Dip_DH , E l e v a t i o n C a l c _ D H , ElevationMGS_DH , Away_DH , R_Calc_DH , R_MGS_DH)
447
448 Case ( 3 )
449
450 ! Opening , r e a d i n g and a l l o c a t i n g
451
452 W r i t e ( * , ’ (A) ’ ) " Give p r o g r a m r u n o p t i o n , ’ 1 ’ = f a s t , ’ 2 ’ = f u l l : "
453 Read ( * , ’ ( I ) ’ ) RunOption
454
455 Write ( * , * )
456 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
457 Write ( * , * )
458
215

459 ! Open ( S i e v e R e s u l t s _ O l d , f i l e = f i l e f o l d e r _ i n / / " S i e v e R e s u l t s . csv " )


460
461 Open ( S i e v e R e s u l t s , f i l e = f i l e f o l d e r _ i n / / " SieveResultsV3 . csv " )
462 ! . . . V1 i s a f i l e composed o f d i f f e r e n t g e f v a l u e s , c r e a t e d by someone e l s e , . . . V2
composed o f t h e r e q u i r e d v a l u e s b u t some . g e f f i l e s had i n v a l i d d a t a , . . . V3 i s c o r r e c t e d
f o r t h e e r r o r s from t h e . g e f f i l e s .
463
464 Open ( S i e v e R e s u l t s _ V , f i l e = f i l e f o l d e r _ i n / / " SieveResults_V . csv " ) ! S a m p l e s from
the i n t i t i a l s i t e i n v e s t i g a t i o n s .
465
466 Open ( O u t p u t F o r m S i e v e , f i l e = f i l e f o l d e r _ o u t / / " O u t p u t F o r m a t i o n S i e v e . c s v " )
467 W r i t e ( O u t p u t F o r m S i e v e , ’ (A) ’ ) " Sample_Code ; F o r m a t i o n _ S a m p l i n g _ T i m e ; DevMinTot ;
Sample_Code_V ; F o r m a t i o n _ V ; F o r m a t i o n Grouped " ! Writes the headers into the f i l e
, t h e f i l e i s f i l l e d w i t h d a t a i n a l o o p f u r t h e r on i n t h e p r o g r a m .
468
469 ! C a l l R e a d i n g F i l e S i e v e ( S i e v e R e s u l t s _ O l d , Sample_Code , D)
470
471 C a l l R e a d i n g F i l e S i e v e ( S i e v e R e s u l t s _ V , Sample_Code_V , D_V)
472
473 C a l l R e a d i n g F i l e S i e v e V 2 ( S i e v e R e s u l t s , Sample_Code , D)
474
475 A l l o c a t e ( DevTot ( s i z e (D_V) / 9 9 ) )
476 A l l o c a t e ( DevMinTot ( s i z e (D) / 9 9 ) )
477 A l l o c a t e ( F o r m a t i o n _ V ( s i z e (D_V) / 9 9 ) )
478 A l l o c a t e ( F o r m a t i o n _ S a m p l i n g _ T i m e ( s i z e (D) / 9 9 ) )
479 A l l o c a t e ( F o r m a t i o n _ R e s u l t G r o u p ( s i z e (D) / 9 9 ) )
480 A l l o c a t e ( Char_NA_T ( 9 9 ) )
481 A l l o c a t e ( Char_NA_DH ( 9 9 ) )
482 A l l o c a t e ( Char_EEBB_T ( 9 9 ) )
483 A l l o c a t e ( Char_EEBB_DH ( 9 9 ) )
484 A l l o c a t e ( Char_URTY_T ( 9 9 ) )
485 A l l o c a t e ( Char_URTY_DH ( 9 9 ) )
486 A l l o c a t e ( Char_EE_T ( 9 9 ) )
487 A l l o c a t e ( Char_EE_DH ( 9 9 ) )
488 A l l o c a t e ( Char_URK_DH ( 9 9 ) )
489 A l l o c a t e ( Char_PZ_DH ( 9 9 ) )
490 A l l o c a t e ( Char_PE_DH ( 9 9 ) )
491 A l l o c a t e ( Char_BX_DH ( 9 9 ) )
492 A l l o c a t e ( Char_AP_DH ( 9 9 ) )
493
494 ! A s s i g n i n g and c a l c u l a t i o n s
495
496 ! Based on t h e s i e v e c u r v e s c r e a t e d from t h e s a m p l e s t a k e n from t h e v e r t i c a l d r i l l i n g s ,
as found in t he Grondonderzoek r a p p o r t .
497 Formation_V ( 1 : 5 ) = ’ F o r m a t i o n o f N a a l d w i j k T (NA) ’
498 Char_NA_T = (D ( 1 , : ) +D ( 2 , : ) +D ( 3 , : ) +D ( 4 , : ) +D ( 5 , : ) ) / 5
499
500 Formation_V ( 6 : 1 0 ) = ’Eem F o r m a t i o n , B r u i n e Bank T ( EE−BB) ’
501 Char_EEBB_T = (D ( 6 , : ) +D ( 7 , : ) +D ( 8 , : ) +D ( 9 , : ) +D ( 1 0 , : ) ) / 5
502
503 Formation_V ( 1 1 : 1 4 ) = ’Eem F o r m a t i o n T ( EE ) ’
504 Char_EE_T = (D ( 1 1 , : ) +D ( 1 2 , : ) +D ( 1 3 , : ) +D ( 1 4 , : ) ) / 4
505
506 Formation_V ( 1 5 : 1 9 ) = ’ F o r m a t i o n o f Urk , T y n j e T (URTY) ’
507 Char_URTY_T = (D ( 1 5 , : ) +D ( 1 6 , : ) +D ( 1 7 , : ) +D ( 1 8 , : ) +D ( 1 9 , : ) ) / 5
508
509 Formation_V ( 2 0 ) = ’ F o r m a t i o n o f N a a l d w i j k DH (NA) ’
510 Char_NA_DH = D( 2 0 , : )
511
512 Formation_V ( 2 1 ) = ’ F o r m a t i o n o f B o x t e l DH (BX) ’
513 Char_BX_DH = D( 2 1 , : )
514
515 Formation_V ( 2 2 : 2 4 ) = ’Eem F o r m a t i o n , B r u i n e Bank DH ( EE−BB) ’
516 Char_EEBB_DH = (D ( 2 2 , : ) +D ( 2 3 , : ) +D ( 2 4 , : ) ) / 3
517
518 Formation_V ( 2 5 : 2 9 ) = ’Eem F o r m a t i o n DH ( EE ) ’
519 Char_EE_DH = (D ( 2 5 , : ) +D ( 2 6 , : ) +D ( 2 7 , : ) +D ( 2 8 , : ) +D ( 2 9 , : ) ) / 5
520
521 Formation_V ( 3 0 : 3 2 ) = ’ F o r m a t i o n o f Urk , T y n j e DH (URTY) ’
522 Char_URTY_DH = (D ( 3 0 , : ) +D ( 3 1 , : ) +D ( 3 2 , : ) ) / 3
523
216 F. Code of the MarsdiepVisual Program

524 Formation_V ( 3 3 : 3 6 ) = ’ P e e l o F o r m a t i o n DH ( PE ) ’
525 Char_PE_DH = (D ( 3 3 , : ) +D ( 3 4 , : ) +D ( 3 5 , : ) +D ( 3 6 , : ) ) / 4
526
527 Formation_V ( 3 7 ) = ’ F o r m a t i o n o f Urk DH’
528 Char_URK_DH = D( 3 7 , : )
529
530 Formation_V ( 3 8 : 4 1 ) = ’ F o r m a t i o n o f A p p e l s c h a DH ( AP ) ’
531 Char_AP_DH = (D ( 3 8 , : ) +D ( 3 9 , : ) +D ( 4 0 , : ) +D ( 4 1 , : ) ) / 4
532
533 Formation_V ( 4 2 : 4 3 ) = ’ F o r m a t i o n o f P e i z e DH ( PZ ) ’
534 Char_PZ_DH = (D ( 4 2 , : ) +D ( 4 3 , : ) ) / 2
535
536 ! Based on t h e c r o s s − s e c t i o n made b a s e d on s e i s m i c d a t a , c p t d a t a and d r i l l i n g s .
537 Formation_Sampling_Time ( 1 ) = ’Eem F o r m a t i o n , B r u i n e Bank DH ( EE−BB) ’
538 Formation_Sampling_Time ( 2 : 1 1 ) = ’ P e e l o F o r m a t i o n DH ( PE ) ’
539 Formation_Sampling_Time ( 1 2 ) = ’ F o r m a t i o n o f B o x t e l DH (BX) ’
540 Formation_Sampling_Time ( 1 3 ) = ’Eem F o r m a t i o n , B r u i n e Bank DH ( EE−BB) ’
541 Formation_Sampling_Time ( 1 4 ) = ’ P e e l o F o r m a t i o n DH ( PE ) ’
542 Formation_Sampling_Time ( 1 5 : 3 1 ) = ’ F o r m a t i o n o f A p p e l s c h a DH ( AP ) ’
543 Formation_Sampling_Time ( 3 2 : 3 3 ) = ’Eem F o r m a t i o n , B r u i n e Bank T ( EE−BB) ’
544 Formation_Sampling_Time ( 3 4 ) = ’ F o r m a t i o n o f D r e n t h e T (DR) ’
545 Formation_Sampling_Time ( 3 5 : 3 6 ) = ’ F o r m a t i o n o f Eem / Urk T ( EE−URTY) ’
546 Formation_Sampling_Time ( 3 7 : 4 7 ) = ’ F o r m a t i o n o f Urk , T y n j e T (URTY) ’
547 Formation_Sampling_Time ( 4 8 : 5 5 ) = ’ Valley F i l l ( val1_b ) ’
548 Formation_Sampling_Time ( 5 6 : 5 8 ) = ’ F o r m a t i o n o f Urk , T y n j e T (URTY) ’
549 Formation_Sampling_Time ( 5 9 : 6 9 ) = ’ P e e l o F o r m a t i o n , N i e u w o l d a T ( PENI ) ’
550
551 ! Based on g r o u p s made o f t h e s a m p l e s r e s u l t i n g from t h e s i e v e t e s t s
552 Formation_ResultGroup (12) = " Group DH 1 "
553 Formation_ResultGroup (13) = " Group DH 2 "
554 Formation_ResultGroup ( 1 : 4 ) = " Group DH 3 "
555 Formation_ResultGroup (14) = " Group DH 3 "
556 Formation_ResultGroup (5:11) = " Group DH 4 "
557 Formation_ResultGroup (15) = " Group DH 5 "
558 Formation_ResultGroup (16:19) = " Group DH 6 "
559 Formation_ResultGroup (20:31) = " Group DH 7 "
560
561 Formation_ResultGroup (32) = " Group T 1"
562 Formation_ResultGroup (33:34) = " Group T 2"
563 Formation_ResultGroup (35:36) = " Group T 3"
564 Formation_ResultGroup (37:42) = " Group T 4"
565 Formation_ResultGroup (43) = " Group To Be Done ! "
566 Formation_ResultGroup (44:46) = " Group T 5"
567 Formation_ResultGroup (47:50) = " Group T 6"
568 Formation_ResultGroup (51:55) = " Group T 7"
569 Formation_ResultGroup (56:58) = " Group T 8"
570 Formation_ResultGroup (59:64) = " Group T 9"
571 Formation_ResultGroup (65:69) = " Group T 10 "
572
573 Do i = 1 , ( s i z e (D) / 9 9 )
574 Do j = 1 , ( s i z e (D_V) / 9 9 )
575 Dev = sum ( ( D( i , : ) −D_V( j , : ) ) * * 2 )
576 DevTot ( j ) = Dev
577 ! W r i t e ( * , * ) " DevTot ( j ) = " , DevTot ( j )
578 End Do
579 ! W r i t e ( * , ’ ( A, I3 , A, I3 , A, F ) ’ ) " i , j , Min Dev = " , i , " " , m i n l o c ( DevTot ) , " " , m i n v a l ( DevTot
)
580
581 Index1 = i
582
583 A l l o c a t e ( TempArr ( 2 ) )
584 TempArr = M i n l o c ( DevTot )
585 MinValPos = TempArr ( 1 )
586 D e a l l o c a t e ( TempArr )
587
588 I f ( RunOption == 2 ) Then
589 title = ’ Most S i m i l a i r S a m p l e s ’ / / Sample_Code ( i )
590 C a l l f 2 g p S i e v e 2 ( t i t l e , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s by Weight [%] ’ ,
Sample_Code , D, Sample_Code_V , D_V , I n d e x 1 , ’ 1 k ’ , MinValPos , ’ 1 l ’ )
591 End I f
592
217

593 DevMinTot ( i ) = m i n v a l ( DevTot )


594
595 W r i t e ( O u t p u t F o r m S i e v e , ’ ( 4 (A) , F6 . 3 , 6 ( A) ) ’ ) Sample_Code ( i ) , " ; " , F o r m a t i o n _ S a m p l i n g _ T i m e (
i ) , " ; " , DevMinTot ( i ) , " ; " , t r i m ( Sample_Code_V ( MinValPos ) ) , " ; " , t r i m ( F o r m a t i o n _ V ( MinValPos ) ) ,
" ; " , t r i m ( F o r m a t i o n _ R e s u l t G r o u p ( MinValPos ) )
596
597 End Do
598
599 ! Making t h e g r a p h s
600
601 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time B o x t e l F o r m a t i o n ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 1 2 , ’ 1 k ’ , Sample_Code , D)
602
603 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time K r e f t e n h e y e F o r m a t i o n DH’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 1 3 , ’ 1 k ’ , Sample_Code , D)
604
605 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time Eem F o r m a t i o n DH’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 1 , ’ 1 k ’ , Sample_Code , D)
606
607 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time Urk F o r m a t i o n − T y n j e DH’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 2 , ’ 1 k ’ , Sample_Code , D, 3 , ’ 1 l ’ , 4 , ’ 1m’ , 1 4 , ’ 1 n ’ )
608
609 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time P e e l o F o r m a t i o n DH’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 5 , ’ 1 k ’ , Sample_Code , D, 6 , ’ 1 l ’ , 7 , ’ 1m’ , 8 , ’ 1 n ’ , 9 , ’ 1 o ’ , 1 0 , ’ 1 p ’ , 1 1 , ’ 1
q ’ ,15 , ’1 r ’ ,16 , ’1s ’ )
610
611 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time A p p e l s c h a F o r m a t i o n DH’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 1 7 , ’ 1 k ’ , Sample_Code , D, 1 8 , ’ 1 l ’ , 1 9 , ’ 1m’ , 2 0 , ’ 1 n ’ , 2 1 , ’ 1 o
’ , 2 2 , ’ 1 p ’ , 2 3 , ’ 1 q ’ , 2 4 , ’ 1 r ’ , 2 5 , ’ 1 s ’ , 2 6 , ’ 1 t ’ , 2 7 , ’ 1 u ’ , 2 8 , ’ 1 v ’ , 2 9 , ’ 1w ’ , 3 0 , ’ 1 x ’ , 3 1 , ’ 1 y ’ )
612
613 Write ( * , * )
614
615 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time B o x t e l F o r m a t i o n T ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 3 2 , ’ 1 k ’ , Sample_Code , D)
616
617 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time K r e f t e n h e y e F o r m a t i o n T ’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 3 3 , ’ 1 k ’ , Sample_Code , D)
618
619 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time Eem F o r m a t i o n T ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 3 4 , ’ 1 k ’ , Sample_Code , D, 3 5 , ’ 1 l ’ , 4 7 , ’ 1m’ , 4 8 , ’ 1 n ’ , 4 9 , ’ 1 o ’ , 5 0 , ’ 1 p ’
,51 , ’ 1q ’ ,52 , ’ 1 r ’ ,53 , ’ 1 s ’ ,54 , ’ 1 t ’ ,55 , ’ 1u ’ )
620
621 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time Urk F o r m a t i o n − T y n j e T ’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 3 6 , ’ 1 k ’ , Sample_Code , D, 3 7 , ’ 1 l ’ , 3 8 , ’ 1m’ , 3 9 , ’ 1 n ’ , 4 0 , ’ 1 o
’ , 4 1 , ’ 1 p ’ , 4 2 , ’ 1 q ’ , 4 3 , ’ 1 r ’ , 4 4 , ’ 1 s ’ , 4 5 , ’ 1 t ’ , 4 6 , ’ 1 u ’ , 5 6 , ’ 1 v ’ , 5 7 , ’ 1w ’ , 5 8 , ’ 1 x ’ )
622
623 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time A p p e l s c h a F o r m a t i o n − W e e r d i n g h e T ’ , ’ D i a m e t e r [
mm] ’ , ’ Summation P e r c e n t a g e s by Weight [%] ’ , 5 9 , ’ 1 k ’ , Sample_Code , D)
624
625 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e S a m p l i n g Time A p p e l s c h a F o r m a t i o n T ’ , ’ D i a m e t e r [mm] ’ , ’
Summation P e r c e n t a g e s by Weight [%] ’ , 6 0 , ’ 1 k ’ , Sample_Code , D, 6 1 , ’ 1 l ’ , 6 2 , ’ 1m’ , 6 3 , ’ 1 n ’ , 6 4 , ’ 1 o
’ ,65 , ’ 1p ’ ,66 , ’ 1q ’ ,67 , ’ 1 r ’ ,68 , ’ 1 s ’ ,69 , ’ 1 t ’ )
626
627 Write ( * , * )
628
629 I f ( RunOption == 2 ) Then
630 ! R e c r e a t e s t h e c u r v e s from t h e v e r t i c a l s a m p l e s .
631 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e T e x e l N a a l d w i j k V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 1 , ’ 1 k ’ , Sample_Code_V , D_V , 2 , ’ 1 l ’ , 3 , ’ 1m’ , 4 , ’ 1 n ’ , 5 , ’ 1 o ’ )
632
633 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e T e x e l Eem B r u i n e Bank V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 6 , ’ 1 k ’ , Sample_Code_V , D_V , 7 , ’ 1 l ’ , 8 , ’ 1m’ , 9 , ’ 1 n ’ , 1 0 , ’ 1 o ’ )
634
635 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e T e x e l Eem V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s by
Weight [%] ’ , 1 1 , ’ 1 k ’ , Sample_Code_V , D_V, 1 2 , ’ 1 l ’ , 1 3 , ’ 1m’ , 1 4 , ’ 1 n ’ )
636
637 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e T e x e l Urk T y n j e V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 1 5 , ’ 1 k ’ , Sample_Code_V , D_V, 1 6 , ’ 1 l ’ , 1 7 , ’ 1m’ , 1 8 , ’ 1 n ’ , 1 9 , ’ 1 o ’ )
638
639 Write ( * , * )
640
218 F. Code of the MarsdiepVisual Program

641 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r N a a l d w i j k V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation


P e r c e n t a g e s by Weight [%] ’ , 2 0 , ’ 1 k ’ , Sample_Code_V , D_V)
642
643 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r B o x t e l V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 2 1 , ’ 1 k ’ , Sample_Code_V , D_V)
644
645 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r Eem B r u i n e Bank V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 2 2 , ’ 1 k ’ , Sample_Code_V , D_V, 2 3 , ’ 1 l ’ , 2 4 , ’ 1m’ )
646
647 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r Eem V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 2 5 , ’ 1 k ’ , Sample_Code_V , D_V, 2 6 , ’ 1 l ’ , 2 7 , ’ 1m’ , 2 8 , ’ 1 n ’ , 2 9 , ’ 1 o ’ )
648
649 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r Urk T y n j e V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 3 0 , ’ 1 k ’ , Sample_Code_V , D_V, 3 1 , ’ 1 l ’ , 3 2 , ’ 1m’ )
650
651 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r P e e l o V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 3 3 , ’ 1 k ’ , Sample_Code_V , D_V, 3 4 , ’ 1 l ’ , 3 5 , ’ 1m’ , 3 6 , ’ 1 n ’ )
652
653 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r Urk V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 3 7 , ’ 1 k ’ , Sample_Code_V , D_V)
654
655 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r A p p e l s c h a V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation
P e r c e n t a g e s by Weight [%] ’ , 3 8 , ’ 1 k ’ , Sample_Code_V , D_V, 3 9 , ’ 1 l ’ , 4 0 , ’ 1m’ , 4 1 , ’ 1 n ’ )
656
657 C a l l f 2 g p S i e v e ( ’ S i e v e c u r v e Den H e l d e r P e i z e V ’ , ’ D i a m e t e r [mm] ’ , ’ Summation P e r c e n t a g e s
by Weight [%] ’ , 4 2 , ’ 1 k ’ , Sample_Code_V , D_V, 4 2 , ’ 1 l ’ )
658
659 End I f
660
661 ! Closing t h i s Option
662
663 Close ( Si ev eRe su lts )
664 ! Close ( SieveResults_Old )
665 Close ( SieveResults_V )
666 Close ( OutputFormSieve )
667
668 D e a l l o c a t e ( Sample_Code , D, Sample_Code_V , D_V)
669 D e a l l o c a t e ( DevTot )
670 D e a l l o c a t e ( DevMinTot )
671 D e a l l o c a t e ( Formation_V )
672 D e a l l o c a t e ( Formation_Sampling_Time )
673 D e a l l o c a t e ( Char_NA_T , Char_NA_DH )
674 D e a l l o c a t e ( Char_EEBB_T , Char_EEBB_DH )
675 D e a l l o c a t e ( Char_URTY_T , Char_URTY_DH )
676 D e a l l o c a t e ( Char_EE_T , Char_EE_DH )
677 D e a l l o c a t e ( Char_URK_DH )
678 D e a l l o c a t e ( Char_PZ_DH )
679 D e a l l o c a t e ( Char_PE_DH )
680 D e a l l o c a t e ( Char_BX_DH )
681 D e a l l o c a t e ( Char_AP_DH )
682
683 Case ( 4 ) ! C r e a t e s a s i n g l e g r a p h o f t h e r e s u l t s o f t h e d i f f e r e n t s c e n a r i o s f o r one
sample .
684
685 Open ( S i e v e R e s u l t s , f i l e = f i l e f o l d e r _ i n / / " SieveResultsV2 . csv " )
686 ! T h i s i s r e a d t o g e t t h e Sample_Code v e c t o r , s i e v e d a t a i s n o t u s e d .
687 C a l l R e a d i n g F i l e S i e v e V 2 ( S i e v e R e s u l t s , Sample_Code , D)
688 No_Samples = L i n e c o u n t ( S i e v e R e s u l t s ) −1 ! −1 f o r h e a d e r s
689
690 Do i =1 , No_Samples
691 W r i t e ( * , ’ ( I 2 . 2 , A, I 2 . 2 ) ’ ) i , " / " , No_Samples
692 ID = Sample_Code ( i )
693 title = ’ C o m p a r i s o n D i f f e r e n t S c e n a r i o s ’ / / t r i m ( ID )
694 C a l l f 2 g p S c e n a r i o s ( ID , t i t l e , ’ D a t e Time ’ , ’ L e n g t h [m] ’ , ’ 2 d ’ , ’ 2 e ’ , ’ 2 f ’ , ’ 2 g ’ , ’ 2 h ’ , ’ 2 i ’ , ’ 2
j ’ , ’ 2 k ’ , ’ 2 l ’ , ’ 2m’ )
695 ! Data i s r e a d i n t h e s u b r o u t i n e , so not d a t a i s p a s s e d t o t h e s u b r o u t i n e .
696 End Do
697
698 Close ( Si ev eRe su lts )
699 D e a l l o c a t e ( Sample_Code )
700
219

701 Case ( 5 ) ! Combines r e s u l t s f o r t h e same c a l c u l a t i o n from t h e d i f f e r e n t s c e n a r i o s .


702
703 Do k = 1 , 2 ! Two f i l e s c o n t a i n t i n g d i f f e r e n t t y p e s o f d a t a
704 I f ( k == 1 ) Then
705 FileContent = ’ _OutputSamplesLoc_Scenario_ ’
706 E l s e I f ( k == 2 ) Then
707 FileContent = ’ _TransportPropTex_Scenario_ ’
708 End I f
709
710 Do j = 1 , 2 ! Two L o c a t i o n s
711 I f ( j == 1 ) Then
712 Location = ’ Texel ’
713 E l s e I f ( j == 2 ) Then
714 L o c a t i o n = ’ Den H e l d e r ’
715 End I f
716
717 Do i =1 ,9
718
719 ! Reading F i l e s
720
721 W r i t e ( F i l e n a m e , ’ (A, A, I 2 . 2 ,A) ’ ) t r i m ( S h o r t ( Trim ( L o c a t i o n ) ) ) , t r i m ( F i l e C o n t e n t ) , i , " . t x t "
722 Open ( I n p u t P a r t , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
723
724 I f ( k == 1 ) Then
725 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , I n p u t P a r t , Var , SampleCode , DateTimeSamples , Var1 ,
Var2 , Var3 , Var4 , Var5 , Var6 )
726 ! For sample l o c a t i o n s : Var1 = SamplingAwayTot , Var2 = S a m p l i n g D e p t h T o t , Var3
= SamplingRightTot
727 ! Var4 = SourceAwayTot , Var5 = S o u r c e D e p t h T o t , Var6 =
SourceRightTot
728 E l s e I f ( k == 2 ) Then
729 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , I n p u t P a r t , Var , SampleCode , DateTimeSamples , Var1 ,
Var2 , Var3 , Var4 , Var5 , Var6 , Var7 , Var8 , Var9 , Var10 , Var11 , Var12 , Var13 , Var14 , Var15 , Var16 , Var17 ,
Var18 )
730 ! For t r a n s p o r t p r o p e r t i e s : Var1 = MaxPLugR , Var2 = AverageV , Var3 = D_Max ,
Var4 = Re_BH , Var5 = Re_HB , Var6 = Re_HB2 , Var7 = S h e a r _ R a t e 1 , Var8 = S h e a r _ R a t e 2
731 ! Var9 = E f f V i s c o s i t y , Var10 = RouseNo , Var11 =
RouseNo2 , Var12 = Re_Gen_BH , Var13 = Re_Gen_HB , Var14 = D90 , Var15 = Dmax BH Min , Var16 =
Dmax BH Max
732 ! Var17 = Dmax HB Min , Var18 = Dmax HB Max
733 End I f
734
735 I f ( i == 1 ) Then
736 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
737 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
738 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
739 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
740 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
741 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
742 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
743 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
744 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
745 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
746 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
747 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
748 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
749 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
750 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
751 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
752 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
753 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 1 ( s i z e ( SampleCode ) ) )
754
755 Var1_Scenario01 = Var1
756 Var2_Scenario01 = Var2
757 Var3_Scenario01 = Var3
758 Var4_Scenario01 = Var4
759 Var5_Scenario01 = Var5
760 Var6_Scenario01 = Var6
761 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario01 = Var7
762 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario01 = Var8
763 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario01 = Var9
220 F. Code of the MarsdiepVisual Program

764 If ( A l l o c a t e d ( Var10 ) ) Var10_Scenario01 = Var10


765 If ( A l l o c a t e d ( Var11 ) ) Var11_Scenario01 = Var11
766 If ( A l l o c a t e d ( Var12 ) ) Var12_Scenario01 = Var12
767 If ( A l l o c a t e d ( Var13 ) ) Var13_Scenario01 = Var13
768 If ( A l l o c a t e d ( Var14 ) ) Var14_Scenario01 = Var14
769 If ( A l l o c a t e d ( Var15 ) ) Var15_Scenario01 = Var15
770 If ( A l l o c a t e d ( Var16 ) ) Var16_Scenario01 = Var16
771 If ( A l l o c a t e d ( Var17 ) ) Var17_Scenario01 = Var17
772 If ( A l l o c a t e d ( Var18 ) ) Var18_Scenario01 = Var18
773
774 E l s e I f ( i == 2 ) Then
775 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
776 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
777 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
778 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
779 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
780 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
781 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
782 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
783 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
784 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
785 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
786 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
787 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
788 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
789 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
790 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
791 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
792 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 2 ( s i z e ( SampleCode ) ) )
793
794 Var1_Scenario02 = Var1
795 Var2_Scenario02 = Var2
796 Var3_Scenario02 = Var3
797 Var4_Scenario02 = Var4
798 Var5_Scenario02 = Var5
799 Var6_Scenario02 = Var6
800 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario02 = Var7
801 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario02 = Var8
802 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario02 = Var9
803 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario02 = Var10
804 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario02 = Var11
805 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario02 = Var12
806 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario02 = Var13
807 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario02 = Var14
808 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario02 = Var15
809 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario02 = Var16
810 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario02 = Var17
811 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario02 = Var18
812
813 E l s e I f ( i == 3 ) Then
814 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
815 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
816 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
817 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
818 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
819 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
820 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
821 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
822 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
823 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
824 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
825 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
826 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
827 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
828 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
829 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
830 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
831 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 3 ( s i z e ( SampleCode ) ) )
832
833 Var1_Scenario03 = Var1
834 Var2_Scenario03 = Var2
221

835 Var3_Scenario03 = Var3


836 Var4_Scenario03 = Var4
837 Var5_Scenario03 = Var5
838 Var6_Scenario03 = Var6
839 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario03 = Var7
840 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario03 = Var8
841 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario03 = Var9
842 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario03 = Var10
843 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario03 = Var11
844 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario03 = Var12
845 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario03 = Var13
846 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario03 = Var14
847 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario03 = Var15
848 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario03 = Var16
849 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario03 = Var17
850 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario03 = Var18
851
852 E l s e I f ( i == 4 ) Then
853 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
854 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
855 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
856 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
857 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
858 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
859 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
860 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
861 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
862 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
863 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
864 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
865 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
866 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
867 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
868 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
869 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
870 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 4 ( s i z e ( SampleCode ) ) )
871
872 Var1_Scenario04 = Var1
873 Var2_Scenario04 = Var2
874 Var3_Scenario04 = Var3
875 Var4_Scenario04 = Var4
876 Var5_Scenario04 = Var5
877 Var6_Scenario04 = Var6
878 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario04 = Var7
879 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario04 = Var8
880 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario04 = Var9
881 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario04 = Var10
882 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario04 = Var11
883 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario04 = Var12
884 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario04 = Var13
885 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario04 = Var14
886 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario04 = Var15
887 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario04 = Var16
888 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario04 = Var17
889 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario04 = Var18
890
891 E l s e I f ( i == 5 ) Then
892 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
893 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
894 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
895 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
896 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
897 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
898 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
899 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
900 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
901 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
902 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
903 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
904 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
905 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 5 ( s i z e ( SampleCode ) ) )
222 F. Code of the MarsdiepVisual Program

906 If ( A l l o c a t e d ( Var15 ) ) Allocate ( Var15_Scenario05 ( size ( SampleCode ) ) )


907 If ( A l l o c a t e d ( Var16 ) ) Allocate ( Var16_Scenario05 ( size ( SampleCode ) ) )
908 If ( A l l o c a t e d ( Var17 ) ) Allocate ( Var17_Scenario05 ( size ( SampleCode ) ) )
909 If ( A l l o c a t e d ( Var18 ) ) Allocate ( Var18_Scenario05 ( size ( SampleCode ) ) )
910
911 Var1_Scenario05 = Var1
912 Var2_Scenario05 = Var2
913 Var3_Scenario05 = Var3
914 Var4_Scenario05 = Var4
915 Var5_Scenario05 = Var5
916 Var6_Scenario05 = Var6
917 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario05 = Var7
918 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario05 = Var8
919 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario05 = Var9
920 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario05 = Var10
921 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario05 = Var11
922 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario05 = Var12
923 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario05 = Var13
924 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario05 = Var14
925 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario05 = Var15
926 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario05 = Var16
927 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario05 = Var17
928 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario05 = Var18
929
930 E l s e I f ( i == 6 ) Then
931 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
932 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
933 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
934 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
935 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
936 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
937 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
938 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
939 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
940 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
941 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
942 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
943 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
944 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
945 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
946 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
947 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
948 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 6 ( s i z e ( SampleCode ) ) )
949
950 Var1_Scenario06 = Var1
951 Var2_Scenario06 = Var2
952 Var3_Scenario06 = Var3
953 Var4_Scenario06 = Var4
954 Var5_Scenario06 = Var5
955 Var6_Scenario06 = Var6
956 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario06 = Var7
957 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario06 = Var8
958 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario06 = Var9
959 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario06 = Var10
960 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario06 = Var11
961 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario06 = Var12
962 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario06 = Var13
963 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario06 = Var14
964 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario06 = Var15
965 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario06 = Var16
966 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario06 = Var17
967 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario06 = Var18
968
969 E l s e I f ( i == 7 ) Then
970 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
971 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
972 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
973 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
974 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
975 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
976 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
223

977 If ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )


978 If ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
979 If ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
980 If ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
981 If ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
982 If ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
983 If ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
984 If ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
985 If ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
986 If ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
987 If ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 7 ( s i z e ( SampleCode ) ) )
988
989 Var1_Scenario07 = Var1
990 Var2_Scenario07 = Var2
991 Var3_Scenario07 = Var3
992 Var4_Scenario07 = Var4
993 Var5_Scenario07 = Var5
994 Var6_Scenario07 = Var6
995 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario07 = Var7
996 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario07 = Var8
997 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario07 = Var9
998 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario07 = Var10
999 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario07 = Var11
1000 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario07 = Var12
1001 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario07 = Var13
1002 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario07 = Var14
1003 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario07 = Var15
1004 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario07 = Var16
1005 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario07 = Var17
1006 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario07 = Var18
1007
1008 E l s e I f ( i == 8 ) Then
1009 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1010 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1011 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1012 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1013 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1014 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1015 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1016 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1017 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1018 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1019 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1020 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1021 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1022 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1023 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1024 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1025 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1026 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 8 ( s i z e ( SampleCode ) ) )
1027
1028 Var1_Scenario08 = Var1
1029 Var2_Scenario08 = Var2
1030 Var3_Scenario08 = Var3
1031 Var4_Scenario08 = Var4
1032 Var5_Scenario08 = Var5
1033 Var6_Scenario08 = Var6
1034 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario08 = Var7
1035 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario08 = Var8
1036 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario08 = Var9
1037 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario08 = Var10
1038 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario08 = Var11
1039 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario08 = Var12
1040 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario08 = Var13
1041 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario08 = Var14
1042 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario08 = Var15
1043 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario08 = Var16
1044 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario08 = Var17
1045 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario08 = Var18
1046
1047 E l s e I f ( i == 9 ) Then
224 F. Code of the MarsdiepVisual Program

1048 A l l o c a t e ( V a r 1 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1049 A l l o c a t e ( V a r 2 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1050 A l l o c a t e ( V a r 3 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1051 A l l o c a t e ( V a r 4 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1052 A l l o c a t e ( V a r 5 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1053 A l l o c a t e ( V a r 6 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1054 I f ( A l l o c a t e d ( Var7 ) ) A l l o c a t e ( V a r 7 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1055 I f ( A l l o c a t e d ( Var8 ) ) A l l o c a t e ( V a r 8 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1056 I f ( A l l o c a t e d ( Var9 ) ) A l l o c a t e ( V a r 9 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1057 I f ( A l l o c a t e d ( Var10 ) ) A l l o c a t e ( V a r 1 0 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1058 I f ( A l l o c a t e d ( Var11 ) ) A l l o c a t e ( V a r 1 1 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1059 I f ( A l l o c a t e d ( Var12 ) ) A l l o c a t e ( V a r 1 2 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1060 I f ( A l l o c a t e d ( Var13 ) ) A l l o c a t e ( V a r 1 3 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1061 I f ( A l l o c a t e d ( Var14 ) ) A l l o c a t e ( V a r 1 4 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1062 I f ( A l l o c a t e d ( Var15 ) ) A l l o c a t e ( V a r 1 5 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1063 I f ( A l l o c a t e d ( Var16 ) ) A l l o c a t e ( V a r 1 6 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1064 I f ( A l l o c a t e d ( Var17 ) ) A l l o c a t e ( V a r 1 7 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1065 I f ( A l l o c a t e d ( Var18 ) ) A l l o c a t e ( V a r 1 8 _ S c e n a r i o 0 9 ( s i z e ( SampleCode ) ) )
1066
1067 Var1_Scenario09 = Var1
1068 Var2_Scenario09 = Var2
1069 Var3_Scenario09 = Var3
1070 Var4_Scenario09 = Var4
1071 Var5_Scenario09 = Var5
1072 Var6_Scenario09 = Var6
1073 I f ( A l l o c a t e d ( Var7 ) ) Var7_Scenario09 = Var7
1074 I f ( A l l o c a t e d ( Var8 ) ) Var8_Scenario09 = Var8
1075 I f ( A l l o c a t e d ( Var9 ) ) Var9_Scenario09 = Var9
1076 I f ( A l l o c a t e d ( Var10 ) ) Var10_Scenario09 = Var10
1077 I f ( A l l o c a t e d ( Var11 ) ) Var11_Scenario09 = Var11
1078 I f ( A l l o c a t e d ( Var12 ) ) Var12_Scenario09 = Var12
1079 I f ( A l l o c a t e d ( Var13 ) ) Var13_Scenario09 = Var13
1080 I f ( A l l o c a t e d ( Var14 ) ) Var14_Scenario09 = Var14
1081 I f ( A l l o c a t e d ( Var15 ) ) Var15_Scenario09 = Var15
1082 I f ( A l l o c a t e d ( Var16 ) ) Var16_Scenario09 = Var16
1083 I f ( A l l o c a t e d ( Var17 ) ) Var17_Scenario09 = Var17
1084 I f ( A l l o c a t e d ( Var18 ) ) Var18_Scenario09 = Var18
1085
1086 End I f
1087
1088 Close ( I n p u t p a r t )
1089 D e a l l o c a t e ( SampleCode , DateTimeSamples , Var , Var1 , Var2 , Var3 , Var4 , Var5 , Var6 )
1090 I f ( A l l o c a t e d ( Var7 ) ) D e a l l o c a t e ( Var7 )
1091 I f ( A l l o c a t e d ( Var8 ) ) D e a l l o c a t e ( Var8 )
1092 I f ( A l l o c a t e d ( Var9 ) ) D e a l l o c a t e ( Var9 )
1093 I f ( A l l o c a t e d ( Var10 ) ) D e a l l o c a t e ( Var10 )
1094 I f ( A l l o c a t e d ( Var11 ) ) D e a l l o c a t e ( Var11 )
1095 I f ( A l l o c a t e d ( Var12 ) ) D e a l l o c a t e ( Var12 )
1096 I f ( A l l o c a t e d ( Var13 ) ) D e a l l o c a t e ( Var13 )
1097 I f ( A l l o c a t e d ( Var14 ) ) D e a l l o c a t e ( Var14 )
1098 I f ( A l l o c a t e d ( Var15 ) ) D e a l l o c a t e ( Var15 )
1099 I f ( A l l o c a t e d ( Var16 ) ) D e a l l o c a t e ( Var16 )
1100 I f ( A l l o c a t e d ( Var17 ) ) D e a l l o c a t e ( Var17 )
1101 I f ( A l l o c a t e d ( Var18 ) ) D e a l l o c a t e ( Var18 )
1102
1103 End Do
1104
1105 ! Writing Files
1106
1107 Open ( I n p u t p a r t , f i l e = f i l e f o l d e r _ o u t / / trim ( Filename ) )
1108
1109 I f ( k == 1 ) Then
1110 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , I n p u t P a r t , Var , SampleCode , DateTimeSamples , Var1 ,
Var2 , Var3 , Var4 , Var5 , Var6 )
1111 E l s e I f ( k == 2 ) Then
1112 C a l l R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , I n p u t P a r t , Var , SampleCode , DateTimeSamples , Var1 ,
Var2 , Var3 , Var4 , Var5 , Var6 , Var7 , Var8 , Var9 , Var10 , Var11 , Var12 , Var13 , Var14 , Var15 , Var16 , Var17 ,
Var18 )
1113 End I f
1114
1115 Close ( I n p u t p a r t )
225

1116
1117 I f ( k == 1 ) Then
1118
1119 W r i t e ( F i l e n a m e _ O u t , ’ ( 2 (A) ) ’ ) trim ( Short ( trim ( Location ) ) ) , " _Locations_Scenarios .
csv "
1120 Open ( O u t p u t S c e n a r i o s , f i l e = f i l e f o l d e r _ o u t / / Filename_Out )
1121
1122 W r i t e ( O u t p u t S c e n a r i o s , ’ (A, 2 7 ( A, A, A) ) ’ ) t r i m ( Var ( 1 ) ) , " ; " , t r i m ( Var ( 6 ) ) , "
S c e n a r i o 1 " , " ; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 3 " , " ; " , t r i m (
Var ( 6 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 6 " , "
; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 6 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 6 ) ) , "
S c e n a r i o 9 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 1 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 2 " , " ; " , t r i m (
Var ( 7 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 5 " , "
; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 7 ) ) , "
S c e n a r i o 8 " , " ; " , t r i m ( Var ( 7 ) ) , " S c e n a r i o 9 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 1 " , " ; " , t r i m (
Var ( 8 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 4 " , "
; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 8 ) ) , "
S c e n a r i o 7 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 8 ) ) , " S c e n a r i o 9 "
1123
1124 Do i =1 , s i z e ( SampleCode )
1125 W r i t e ( O u t p u t S c e n a r i o s , ’ (A, 2 7 ( A, F ) ) ’ ) SampleCode ( i ) , " ; " , V a r 4 _ S c e n a r i o 0 1 ( i ) , " ; "
, Var4_Scenario02 ( i ) , " ; " , Var4_Scenario03 ( i ) , " ; " , Var4_Scenario04 ( i ) , " ; " , Var4_Scenario05 ( i ) ,
" ; " , Var4_Scenario06 ( i ) , " ; " , Var4_Scenario07 ( i ) , " ; " , Var4_Scenario08 ( i ) , " ; " , Var4_Scenario09 (
i ) , " ; " , Var5_Scenario01 ( i ) , " ; " , Var5_Scenario02 ( i ) , " ; " , Var5_Scenario03 ( i ) , " ; " ,
Var5_Scenario04 ( i ) , " ; " , Var5_Scenario05 ( i ) , " ; " , Var5_Scenario06 ( i ) , " ; " , Var5_Scenario07 ( i ) , "
; " , Var5_Scenario08 ( i ) , " ; " , Var5_Scenario09 ( i ) , " ; " , Var6_Scenario01 ( i ) , " ; " , Var6_Scenario02 ( i
) , " ; " , Var6_Scenario03 ( i ) , " ; " , Var6_Scenario04 ( i ) , " ; " , Var6_Scenario05 ( i ) , " ; " ,
Var6_Scenario06 ( i ) , " ; " , Var6_Scenario07 ( i ) , " ; " , Var6_Scenario08 ( i ) , " ; " , Var6_Scenario09 ( i )
1126 End Do
1127
1128 E l s e I f ( k == 2 ) Then
1129
1130 W r i t e ( F i l e n a m e _ O u t , ’ ( 2 (A) ) ’ ) trim ( Short ( trim ( Location ) ) ) , " _Transport_1_Scenarios
. csv "
1131 Open ( O u t p u t S c e n a r i o s 1 , f i l e = f i l e f o l d e r _ o u t / / Filename_Out )
1132
1133 W r i t e ( O u t p u t S c e n a r i o s 1 , ’ (A, 2 7 ( A, A, A) ) ’ ) t r i m ( Var ( 1 ) ) , " ; " , t r i m ( Var ( 4 ) ) , "
S c e n a r i o 1 " , " ; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 3 " , " ; " , t r i m (
Var ( 4 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 6 " , "
; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 4 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 4 ) ) , "
S c e n a r i o 9 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 1 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 2 " , " ; " , t r i m (
Var ( 9 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 5 " , "
; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 9 ) ) , "
S c e n a r i o 8 " , " ; " , t r i m ( Var ( 9 ) ) , " S c e n a r i o 9 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 1 " , " ; " , t r i m
( Var ( 1 0 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o
4 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 1 0 )
) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 1 0 ) ) , " S c e n a r i o 9 "
1134
1135 Do i =1 , s i z e ( SampleCode )
1136 W r i t e ( O u t p u t S c e n a r i o s 1 , ’ (A, 2 7 ( A, F ) ) ’ ) SampleCode ( i ) , " ; " , V a r 2 _ S c e n a r i o 0 1 ( i ) , " ;
" , Var2_Scenario02 ( i ) , " ; " , Var2_Scenario03 ( i ) , " ; " , Var2_Scenario04 ( i ) , " ; " , Var2_Scenario05 ( i )
, " ; " , Var2_Scenario06 ( i ) , " ; " , Var2_Scenario07 ( i ) , " ; " , Var2_Scenario08 ( i ) , " ; " , Var2_Scenario09
( i ) , " ; " , Var7_Scenario01 ( i ) , " ; " , Var7_Scenario02 ( i ) , " ; " , Var7_Scenario03 ( i ) , " ; " ,
Var7_Scenario04 ( i ) , " ; " , Var7_Scenario05 ( i ) , " ; " , Var7_Scenario06 ( i ) , " ; " , Var7_Scenario07 ( i ) , "
; " , Var7_Scenario08 ( i ) , " ; " , Var7_Scenario09 ( i ) , " ; " , Var8_Scenario01 ( i ) , " ; " , Var8_Scenario02 ( i
) , " ; " , Var8_Scenario03 ( i ) , " ; " , Var8_Scenario04 ( i ) , " ; " , Var8_Scenario05 ( i ) , " ; " ,
Var8_Scenario06 ( i ) , " ; " , Var8_Scenario07 ( i ) , " ; " , Var8_Scenario08 ( i ) , " ; " , Var8_Scenario09 ( i )
1137 End Do
1138
1139 Write ( OutputScenarios1 , * )
1140 W r i t e ( O u t p u t S c e n a r i o s 1 , ’ (A, 2 7 ( A, F ) ) ’ ) " Averages , e x c l u d i n g 0 : " , " ; " , Average (
Var2_Scenario01 ) , " ; " , Average ( Var2_Scenario02 ) , " ; " , Average ( Var2_Scenario03 ) , " ; " , Average (
Var2_Scenario04 ) , " ; " , Average ( Var2_Scenario05 ) , " ; " , Average ( Var2_Scenario06 ) , " ; " , Average (
Var2_Scenario07 ) , " ; " , Average ( Var2_Scenario08 ) , " ; " , Average ( Var2_Scenario09 ) , " ; " , Average (
Var7_Scenario01 ) , " ; " , Average ( Var7_Scenario02 ) , " ; " , Average ( Var7_Scenario03 ) , " ; " , Average (
Var7_Scenario04 ) , " ; " , Average ( Var7_Scenario05 ) , " ; " , Average ( Var7_Scenario06 ) , " ; " , Average (
Var7_Scenario07 ) , " ; " , Average ( Var7_Scenario08 ) , " ; " , Average ( Var7_Scenario09 ) , " ; " , Average (
Var8_Scenario01 ) , " ; " , Average ( Var8_Scenario02 ) , " ; " , Average ( Var8_Scenario03 ) , " ; " , Average (
Var8_Scenario04 ) , " ; " , Average ( Var8_Scenario05 ) , " ; " , Average ( Var8_Scenario06 ) , " ; " , Average (
Var8_Scenario07 ) , " ; " , Average ( Var8_Scenario08 ) , " ; " , Average ( Var8_Scenario09 )
1141
226 F. Code of the MarsdiepVisual Program

1142 W r i t e ( F i l e n a m e _ O u t , ’ ( 2 (A) ) ’ ) trim ( Short ( trim ( Location ) ) ) , " _Transport_2_Scenarios


. csv "
1143 Open ( O u t p u t S c e n a r i o s 2 , f i l e = f i l e f o l d e r _ o u t / / Filename_Out )
1144
1145 W r i t e ( O u t p u t S c e n a r i o s 2 , ’ (A, 1 8 ( A, A, A) ) ’ ) t r i m ( Var ( 1 ) ) , " ; " , t r i m ( Var ( 1 4 ) ) , "
S c e n a r i o 1 " , " ; " , t r i m ( Var ( 1 4 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 1 4 ) ) , " Scenario 3" , " ; " ,
t r i m ( Var ( 1 4 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 1 4 ) ) ," Scenario 5" , " ; " , t r i m ( Var ( 1 4 ) ) , "
S c e n a r i o 6 " , " ; " , t r i m ( Var ( 1 4 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 4 ) ) , " Scenario 8" , " ; " ,
t r i m ( Var ( 1 4 ) ) , " S c e n a r i o 9 " , " ; " , t r i m ( Var ( 1 5 ) ) ," Scenario 1" , " ; " , t r i m ( Var ( 1 5 ) ) , "
S c e n a r i o 2 " , " ; " , t r i m ( Var ( 1 5 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 1 5 ) ) , " Scenario 4" , " ; " ,
t r i m ( Var ( 1 5 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 1 5 ) ) ," Scenario 6" , " ; " , t r i m ( Var ( 1 5 ) ) , "
S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 5 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 1 5 ) ) , " Scenario 9"
1146
1147 Do i =1 , s i z e ( SampleCode )
1148 W r i t e ( O u t p u t S c e n a r i o s 2 , ’ (A, 1 8 ( A, F ) ) ’ ) SampleCode ( i ) , " ; " , V a r 1 2 _ S c e n a r i o 0 1 ( i ) , "
; " , Var12_Scenario02 ( i ) , " ; " , Var12_Scenario03 ( i ) , " ; " , Var12_Scenario04 ( i ) , " ; " ,
Var12_Scenario05 ( i ) , " ; " , Var12_Scenario06 ( i ) , " ; " , Var12_Scenario07 ( i ) , " ; " , Var12_Scenario08 (
i ) , " ; " , Var12_Scenario09 ( i ) , " ; " , Var13_Scenario01 ( i ) , " ; " , Var13_Scenario02 ( i ) , " ; " ,
Var13_Scenario03 ( i ) , " ; " , Var13_Scenario04 ( i ) , " ; " , Var13_Scenario05 ( i ) , " ; " , Var13_Scenario06 (
i ) , " ; " , Var13_Scenario07 ( i ) , " ; " , Var13_Scenario08 ( i ) , " ; " , Var13_Scenario09 ( i )
1149 End Do
1150
1151 Write ( OutputScenarios2 , * )
1152 W r i t e ( O u t p u t S c e n a r i o s 2 , ’ (A, 1 8 ( A, F ) ) ’ ) " A v e r a g e s , e x c l u d i n g 0 : " , " ; " , A v e r a g e (
Var12_Scenario01 ) , " ; " , Average ( Var12_Scenario02 ) , " ; " , Average ( Var12_Scenario03 ) , " ; " , Average
( Var12_Scenario04 ) , " ; " , Average ( Var12_Scenario05 ) , " ; " , Average ( Var12_Scenario06 ) , " ; " ,
Average ( Var12_Scenario07 ) , " ; " , Average ( Var12_Scenario08 ) , " ; " , Average ( Var12_Scenario09 ) , " ; "
, Average ( Var13_Scenario01 ) , " ; " , Average ( Var13_Scenario02 ) , " ; " , Average ( Var13_Scenario03 ) , " ;
" , Average ( Var13_Scenario04 ) , " ; " , Average ( Var13_Scenario05 ) , " ; " , Average ( Var13_Scenario06 ) , "
; " , Average ( Var13_Scenario07 ) , " ; " , Average ( Var13_Scenario08 ) , " ; " , Average ( Var13_Scenario09 )
1153
1154 W r i t e ( F i l e n a m e _ O u t , ’ ( 2 (A) ) ’ ) trim ( Short ( trim ( Location ) ) ) , " _Transport_3_Scenarios
. csv "
1155 Open ( O u t p u t S c e n a r i o s 3 , f i l e = f i l e f o l d e r _ o u t / / Filename_Out )
1156
1157 W r i t e ( O u t p u t S c e n a r i o s 3 , ’ ( 3 (A) , 3 6 (A, A, A) ) ’ ) t r i m ( Var ( 1 ) ) , " ; " , t r i m ( Var ( 1 6 ) ) , " ;
" , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 1 " , " ; " , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 1 7 ) ) , "
S c e n a r i o 3 " , " ; " , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 5 " , " ; " ,
t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 7 ) ) , "
S c e n a r i o 8 " , " ; " , t r i m ( Var ( 1 7 ) ) , " S c e n a r i o 9 " , " ; " , t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 1 " , " ; " ,
t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 1 8 ) ) , "
S c e n a r i o 4 " , " ; " , t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 6 " , " ; " ,
t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 8 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 1 8 ) ) , "
S c e n a r i o 9 " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 1 " , " ; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var
( 1 9 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 4 " , " ; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 5 " , "
; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 6 " , " ; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 1 9 ) ) , "
S c e n a r i o 8 " , " ; " , t r i m ( Var ( 1 9 ) ) , " S c e n a r i o 9 " , " ; " , t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 1 " , " ; " ,
t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 2 " , " ; " , t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 3 " , " ; " , t r i m ( Var ( 2 0 ) ) , "
S c e n a r i o 4 " , " ; " , t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 5 " , " ; " , t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 6 " , " ; " ,
t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 7 " , " ; " , t r i m ( Var ( 2 0 ) ) , " S c e n a r i o 8 " , " ; " , t r i m ( Var ( 2 0 ) ) , "
Scenario 9"
1158
1159 Do i =1 , s i z e ( SampleCode )
1160 W r i t e ( O u t p u t S c e n a r i o s 3 , ’ (A, 3 7 ( A, F ) ) ’ ) SampleCode ( i ) , " ; " , V a r 1 4 _ S c e n a r i o 0 1 ( i ) , "
; " , Var15_Scenario01 ( i ) , " ; " , Var15_Scenario02 ( i ) , " ; " , Var15_Scenario03 ( i ) , " ; " ,
Var15_Scenario04 ( i ) , " ; " , Var15_Scenario05 ( i ) , " ; " , Var15_Scenario06 ( i ) , " ; " , Var15_Scenario07 (
i ) , " ; " , Var15_Scenario08 ( i ) , " ; " , Var15_Scenario09 ( i ) , " ; " , Var16_Scenario01 ( i ) , " ; " ,
Var16_Scenario02 ( i ) , " ; " , Var16_Scenario03 ( i ) , " ; " , Var16_Scenario04 ( i ) , " ; " , Var16_Scenario05 (
i ) , " ; " , Var16_Scenario06 ( i ) , " ; " , Var16_Scenario07 ( i ) , " ; " , Var16_Scenario08 ( i ) , " ; " ,
Var16_Scenario09 ( i ) , " ; " , Var17_Scenario01 ( i ) , " ; " , Var17_Scenario02 ( i ) , " ; " , Var17_Scenario03 (
i ) , " ; " , Var17_Scenario04 ( i ) , " ; " , Var17_Scenario05 ( i ) , " ; " , Var17_Scenario06 ( i ) , " ; " ,
Var17_Scenario07 ( i ) , " ; " , Var17_Scenario08 ( i ) , " ; " , Var17_Scenario09 ( i ) , " ; " , Var18_Scenario01 (
i ) , " ; " , Var18_Scenario02 ( i ) , " ; " , Var18_Scenario03 ( i ) , " ; " , Var18_Scenario04 ( i ) , " ; " ,
Var18_Scenario05 ( i ) , " ; " , Var18_Scenario06 ( i ) , " ; " , Var18_Scenario07 ( i ) , " ; " , Var18_Scenario08 (
i ) , " ; " , Var18_Scenario09 ( i )
1161 End Do
1162
1163 Write ( OutputScenarios3 , * )
1164 W r i t e ( O u t p u t S c e n a r i o s 3 , ’ (A, 3 7 ( A, F ) ) ’ ) " A v e r a g e s , e x c l u d i n g 0 : " , " ; " , A v e r a g e (
Var14_Scenario01 ) , " ; " , Average ( Var15_Scenario01 ) , " ; " , Average ( Var15_Scenario02 ) , " ; " , Average
( Var15_Scenario03 ) , " ; " , Average ( Var15_Scenario04 ) , " ; " , Average ( Var15_Scenario05 ) , " ; " ,
227

Average ( Var15_Scenario06 ) , " ; " , Average ( Var15_Scenario07 ) , " ; " , Average ( Var15_Scenario08 ) , " ; "
, Average ( Var15_Scenario09 ) , " ; " , Average ( Var16_Scenario01 ) , " ; " , Average ( Var16_Scenario02 ) , " ;
" , Average ( Var16_Scenario03 ) , " ; " , Average ( Var16_Scenario04 ) , " ; " , Average ( Var16_Scenario05 ) , "
; " , Average ( Var16_Scenario06 ) , " ; " , Average ( Var16_Scenario07 ) , " ; " , Average ( Var16_Scenario08 ) ,
" ; " , Average ( Var16_Scenario09 ) , " ; " , Average ( Var17_Scenario01 ) , " ; " , Average ( Var17_Scenario02 )
, " ; " , Average ( Var17_Scenario03 ) , " ; " , Average ( Var17_Scenario04 ) , " ; " , Average ( Var17_Scenario05
) , " ; " , Average ( Var17_Scenario06 ) , " ; " , Average ( Var17_Scenario07 ) , " ; " , Average (
Var17_Scenario08 ) , " ; " , Average ( Var17_Scenario09 ) , " ; " , Average ( Var18_Scenario01 ) , " ; " , Average
( Var18_Scenario02 ) , " ; " , Average ( Var18_Scenario03 ) , " ; " , Average ( Var18_Scenario04 ) , " ; " ,
Average ( Var18_Scenario05 ) , " ; " , Average ( Var18_Scenario06 ) , " ; " , Average ( Var18_Scenario07 ) , " ; "
, Average ( Var18_Scenario08 ) , " ; " , Average ( Var18_Scenario09 )
1165
1166 End I f
1167
1168 ! C l o s i n g and D e a l l o c a t i n g
1169
1170 Close ( OutputScenarios )
1171 Close ( OutputScenarios1 )
1172 Close ( OutputScenarios2 )
1173 Close ( OutputScenarios3 )
1174
1175 D e a l l o c a t e ( SampleCode , DateTimeSamples , Var , Var1 , Var2 , Var3 , Var4 , Var5 , Var6 )
1176
1177 If ( A l l o c a t e d ( Var7 ) ) D e a l l o c a t e ( Var7 )
1178 If ( A l l o c a t e d ( Var8 ) ) D e a l l o c a t e ( Var8 )
1179 If ( A l l o c a t e d ( Var9 ) ) D e a l l o c a t e ( Var9 )
1180 If ( A l l o c a t e d ( Var10 ) ) D e a l l o c a t e ( Var10 )
1181 If ( A l l o c a t e d ( Var11 ) ) D e a l l o c a t e ( Var11 )
1182 If ( A l l o c a t e d ( Var12 ) ) D e a l l o c a t e ( Var12 )
1183 If ( A l l o c a t e d ( Var13 ) ) D e a l l o c a t e ( Var13 )
1184 If ( A l l o c a t e d ( Var14 ) ) D e a l l o c a t e ( Var14 )
1185 If ( A l l o c a t e d ( Var15 ) ) D e a l l o c a t e ( Var15 )
1186 If ( A l l o c a t e d ( Var16 ) ) D e a l l o c a t e ( Var16 )
1187 If ( A l l o c a t e d ( Var17 ) ) D e a l l o c a t e ( Var17 )
1188 If ( A l l o c a t e d ( Var18 ) ) D e a l l o c a t e ( Var18 )
1189
1190 D e a l l o c a t e ( Var1_Scenario01 , Var1_Scenario02 , Var1_Scenario03 , Var1_Scenario04 ,
Var1_Scenario05 , Var1_Scenario06 , Var1_Scenario07 , Var1_Scenario08 , Var1_Scenario09 )
1191 D e a l l o c a t e ( Var2_Scenario01 , Var2_Scenario02 , Var2_Scenario03 , Var2_Scenario04 ,
Var2_Scenario05 , Var2_Scenario06 , Var2_Scenario07 , Var2_Scenario08 , Var2_Scenario09 )
1192 D e a l l o c a t e ( Var3_Scenario01 , Var3_Scenario02 , Var3_Scenario03 , Var3_Scenario04 ,
Var3_Scenario05 , Var3_Scenario06 , Var3_Scenario07 , Var3_Scenario08 , Var3_Scenario09 )
1193 D e a l l o c a t e ( Var4_Scenario01 , Var4_Scenario02 , Var4_Scenario03 , Var4_Scenario04 ,
Var4_Scenario05 , Var4_Scenario06 , Var4_Scenario07 , Var4_Scenario08 , Var4_Scenario09 )
1194 D e a l l o c a t e ( Var5_Scenario01 , Var5_Scenario02 , Var5_Scenario03 , Var5_Scenario04 ,
Var5_Scenario05 , Var5_Scenario06 , Var5_Scenario07 , Var5_Scenario08 , Var5_Scenario09 )
1195 D e a l l o c a t e ( Var6_Scenario01 , Var6_Scenario02 , Var6_Scenario03 , Var6_Scenario04 ,
Var6_Scenario05 , Var6_Scenario06 , Var6_Scenario07 , Var6_Scenario08 , Var6_Scenario09 )
1196
1197 I f ( A l l o c a t e d ( Var7 ) ) D e a l l o c a t e ( Var7_Scenario01 , Var7_Scenario02 , Var7_Scenario03 ,
Var7_Scenario04 , Var7_Scenario05 , Var7_Scenario06 , Var7_Scenario07 , Var7_Scenario08 ,
Var7_Scenario09 )
1198 I f ( A l l o c a t e d ( Var8 ) ) D e a l l o c a t e ( Var8_Scenario01 , Var8_Scenario02 , Var8_Scenario03 ,
Var8_Scenario04 , Var8_Scenario05 , Var8_Scenario06 , Var8_Scenario07 , Var8_Scenario08 ,
Var8_Scenario09 )
1199 I f ( A l l o c a t e d ( Var9 ) ) D e a l l o c a t e ( Var9_Scenario01 , Var9_Scenario02 , Var9_Scenario03 ,
Var9_Scenario04 , Var9_Scenario05 , Var9_Scenario06 , Var9_Scenario07 , Var9_Scenario08 ,
Var9_Scenario09 )
1200 I f ( A l l o c a t e d ( Var10 ) ) D e a l l o c a t e ( Var10_Scenario01 , Var10_Scenario02 ,
Var10_Scenario03 , Var10_Scenario04 , Var10_Scenario05 , Var10_Scenario06 , Var10_Scenario07 ,
Var10_Scenario08 , Var10_Scenario09 )
1201 I f ( A l l o c a t e d ( Var11 ) ) D e a l l o c a t e ( Var11_Scenario01 , Var11_Scenario02 ,
Var11_Scenario03 , Var11_Scenario04 , Var11_Scenario05 , Var11_Scenario06 , Var11_Scenario07 ,
Var11_Scenario08 , Var11_Scenario09 )
1202 I f ( A l l o c a t e d ( Var12 ) ) D e a l l o c a t e ( Var12_Scenario01 , Var12_Scenario02 ,
Var12_Scenario03 , Var12_Scenario04 , Var12_Scenario05 , Var12_Scenario06 , Var12_Scenario07 ,
Var12_Scenario08 , Var12_Scenario09 )
1203 I f ( A l l o c a t e d ( Var13 ) ) D e a l l o c a t e ( Var13_Scenario01 , Var13_Scenario02 ,
Var13_Scenario03 , Var13_Scenario04 , Var13_Scenario05 , Var13_Scenario06 , Var13_Scenario07 ,
Var13_Scenario08 , Var13_Scenario09 )
1204 I f ( A l l o c a t e d ( Var14 ) ) D e a l l o c a t e ( Var14_Scenario01 , Var14_Scenario02 ,
228 F. Code of the MarsdiepVisual Program

Var14_Scenario03 , Var14_Scenario04 , Var14_Scenario05 , Var14_Scenario06 , Var14_Scenario07 ,


Var14_Scenario08 , Var14_Scenario09 )
1205 I f ( A l l o c a t e d ( Var15 ) ) D e a l l o c a t e ( Var15_Scenario01 , Var15_Scenario02 ,
Var15_Scenario03 , Var15_Scenario04 , Var15_Scenario05 , Var15_Scenario06 , Var15_Scenario07 ,
Var15_Scenario08 , Var15_Scenario09 )
1206 I f ( A l l o c a t e d ( Var16 ) ) D e a l l o c a t e ( Var16_Scenario01 , Var16_Scenario02 ,
Var16_Scenario03 , Var16_Scenario04 , Var16_Scenario05 , Var16_Scenario06 , Var16_Scenario07 ,
Var16_Scenario08 , Var16_Scenario09 )
1207 I f ( A l l o c a t e d ( Var17 ) ) D e a l l o c a t e ( Var17_Scenario01 , Var17_Scenario02 ,
Var17_Scenario03 , Var17_Scenario04 , Var17_Scenario05 , Var17_Scenario06 , Var17_Scenario07 ,
Var17_Scenario08 , Var17_Scenario09 )
1208 I f ( A l l o c a t e d ( Var18 ) ) D e a l l o c a t e ( Var18_Scenario01 , Var18_Scenario02 ,
Var18_Scenario03 , Var18_Scenario04 , Var18_Scenario05 , Var18_Scenario06 , Var18_Scenario07 ,
Var18_Scenario08 , Var18_Scenario09 )
1209
1210 End Do
1211
1212 End Do
1213
1214 Case ( 6 )
1215
1216 Open ( FormationsTNO , f i l e = f i l e f o l d e r _ i n / / " TNOFormations . c s v " )
1217 C a l l R e a d i n g F i l e F o r m a t i o n s ( FormationsTNO , Sample_Code , Fm_No , Fm)
1218
1219 Do l =1 ,9
1220
1221 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1222 Write ( * , * )
1223
1224 ScenarioNo = l
1225
1226 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " T _ O u t p u t S a m p l e s L o c _ S c e n a r i o _ " , S c e n a r i o N o , " . t x t "
1227 Open ( O u t p u t S a m p l e s L o c _ T _ T x t , f i l e = f i l e f o l d e r _ o u t / / ’ F u l l 0 1 − 03\ ’ / / t r i m ( F i l e n a m e ) )
1228
1229 Location = ’ Texel ’
1230 C a l l R e a d i n g F i l e O u t p u t S a m p l e s L o c T x t ( L o c a t i o n , O u t p u t S a m p l e s L o c _ T _ T x t , SampleCode_T ,
DateTimeSamples_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T , S a m p l i n g R i g h t T o t _ T , SourceAwayTot_T
, SourceDepthTot_T , SourceRightTot_T )
1231
1232 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) " D H _ O u t p u t S a m p l e s L o c _ S c e n a r i o _ " , S c e n a r i o N o , " . t x t "
1233 Open ( OutputSamplesLoc_DH_Txt , f i l e = f i l e f o l d e r _ o u t / / ’ F u l l 0 1 − 03\ ’ / / t r i m ( F i l e n a m e ) )
1234
1235 Location = ’ Den H e l d e r ’
1236 C a l l R e a d i n g F i l e O u t p u t S a m p l e s L o c T x t ( L o c a t i o n , OutputSamplesLoc_DH_Txt , SampleCode_DH ,
DateTimeSamples_DH , SamplingAwayTot_DH , SamplingDepthTot_DH , SamplingRightTot_DH ,
SourceAwayTot_DH , SourceDepthTot_DH , S o u r c e R i g h t T o t _ D H )
1237
1238 Allocate ( Filenames (8) )
1239
1240 Do j =1 ,8
1241 W r i t e ( F i l e N a m e s ( j ) , ’ (A, I 2 . 2 ,A) ’ ) " Data_Fm " , j , " . d a t "
1242 Open ( 1 0 0 + j , f i l e = F i l e N a m e s ( j ) )
1243 End Do
1244
1245 Do i =1 , s i z e ( Sample_Code )
1246 Do k =1 , s i z e ( SampleCode_T )
1247 I f ( Sample_Code ( i ) == SampleCode_T ( k ) ) Then
1248 W r i t e ( 1 0 0 +Fm_No ( i ) , ’ (A, 1 x , F , 1 x , F ) ’ ) Sample_Code ( i ) , 100+ SourceAwayTot_T ( k ) ,
SourceDepthTot_T ( k )
1249 End I f
1250 End Do
1251
1252 Do m=1 , s i z e ( SampleCode_DH )
1253 I f ( Sample_Code ( i ) == SampleCode_DH (m) ) Then
1254 W r i t e ( 1 0 0 +Fm_No ( i ) , ’ (A, 1 x , F , 1 x , F ) ’ ) Sample_Code ( i ) , 4700 − SourceAwayTot_DH (m) ,
SourceDepthTot_DH (m)
1255 End I f
1256 End Do
1257 End Do
1258
229

1259 Do j =1 ,8
1260 Close (100+ j )
1261 End Do
1262
1263 BackgroundName = ’ C r o s s s e c t i o n ’ ! . png t y p e i s r e q u i r e d , o r i g i n a l c r o s s − s e c t i o n
1264 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) " F o r m a t i o n s S c e n a r i o " , S c e n a r i o N o
1265 C a l l f2gpwBGFm ( S c e n a r i o N o , BackgroundName , t r i m ( t i t l e ) , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ ,
F i l e N a m e s ( 1 ) , ’ B o x t e l Fm ’ , ’ 4 a ’ , F i l e N a m e s ( 2 ) , ’ K r e f t e n h e y e Fm ’ , ’ 4 b ’ , F i l e N a m e s ( 3 ) , ’Eem Fm ’ , ’ 4
c ’ , F i l e N a m e s ( 4 ) , ’URTY ’ , ’ 4 d ’ , F i l e N a m e s ( 5 ) , ’ P e e l o Fm ’ , ’ 4 e ’ , F i l e N a m e s ( 6 ) , ’URVE ’ , ’ 4 f ’ ,
F i l e N a m e s ( 7 ) , ’ A p p e l s c h a Fm ’ , ’ 4 g ’ , F i l e N a m e s ( 8 ) , ’ A p p e l s c h a W e e r d i n g h e ’ , ’ 4 h ’ )
1266
1267 BackgroundName = ’ C r o s s S e c t i o n B l a n c o ’ ! . png t y p e i s r e q u i r e d , f a c t map
1268 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) " F o r m a t i o n s S c e n a r i o " , S c e n a r i o N o
1269 C a l l f2gpwBGFm ( S c e n a r i o N o , BackgroundName , t r i m ( t i t l e ) , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ ,
F i l e N a m e s ( 1 ) , ’ B o x t e l Fm ’ , ’ 4 a ’ , F i l e N a m e s ( 2 ) , ’ K r e f t e n h e y e Fm ’ , ’ 4 b ’ , F i l e N a m e s ( 3 ) , ’Eem Fm ’ , ’ 4
c ’ , F i l e N a m e s ( 4 ) , ’URTY ’ , ’ 4 d ’ , F i l e N a m e s ( 5 ) , ’ P e e l o Fm ’ , ’ 4 e ’ , F i l e N a m e s ( 6 ) , ’URVE ’ , ’ 4 f ’ ,
F i l e N a m e s ( 7 ) , ’ A p p e l s c h a Fm ’ , ’ 4 g ’ , F i l e N a m e s ( 8 ) , ’ A p p e l s c h a W e e r d i n g h e ’ , ’ 4 h ’ )
1270
1271 BackgroundName = ’ C r o s s S e c t i o n V 2 ’ ! . png t y p e i s r e q u i r e d , p r o p o s a l V2
1272 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) " F o r m a t i o n s S c e n a r i o " , S c e n a r i o N o
1273 C a l l f2gpwBGFm ( S c e n a r i o N o , BackgroundName , t r i m ( t i t l e ) , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ ,
F i l e N a m e s ( 1 ) , ’ B o x t e l Fm ’ , ’ 4 a ’ , F i l e N a m e s ( 2 ) , ’ K r e f t e n h e y e Fm ’ , ’ 4 b ’ , F i l e N a m e s ( 3 ) , ’Eem Fm ’ , ’ 4
c ’ , F i l e N a m e s ( 4 ) , ’URTY ’ , ’ 4 d ’ , F i l e N a m e s ( 5 ) , ’ P e e l o Fm ’ , ’ 4 e ’ , F i l e N a m e s ( 6 ) , ’URVE ’ , ’ 4 f ’ ,
F i l e N a m e s ( 7 ) , ’ A p p e l s c h a Fm ’ , ’ 4 g ’ , F i l e N a m e s ( 8 ) , ’ A p p e l s c h a W e e r d i n g h e ’ , ’ 4 h ’ )
1274
1275 BackgroundName = ’ C r o s s S e c t i o n V 3 ’ ! . png t y p e i s r e q u i r e d , p r o p o s a l V3
1276 W r i t e ( t i t l e , ’ (A, I 2 . 2 ) ’ ) " F o r m a t i o n s S c e n a r i o " , S c e n a r i o N o
1277 C a l l f2gpwBGFm ( S c e n a r i o N o , BackgroundName , t r i m ( t i t l e ) , ’ Sample Code ’ , ’ H e i g h t [m NAP] ’ ,
F i l e N a m e s ( 1 ) , ’ B o x t e l Fm ’ , ’ 4 a ’ , F i l e N a m e s ( 2 ) , ’ K r e f t e n h e y e Fm ’ , ’ 4 b ’ , F i l e N a m e s ( 3 ) , ’Eem Fm ’ , ’ 4
c ’ , F i l e N a m e s ( 4 ) , ’URTY ’ , ’ 4 d ’ , F i l e N a m e s ( 5 ) , ’ P e e l o Fm ’ , ’ 4 e ’ , F i l e N a m e s ( 6 ) , ’URVE ’ , ’ 4 f ’ ,
F i l e N a m e s ( 7 ) , ’ A p p e l s c h a Fm ’ , ’ 4 g ’ , F i l e N a m e s ( 8 ) , ’ A p p e l s c h a W e e r d i n g h e ’ , ’ 4 h ’ )
1278
1279 Do j =1 ,8
1280 W r i t e ( F i l e N a m e s ( j ) , ’ (A, I 2 . 2 ,A) ’ ) " Data_Fm " , j , " . d a t "
1281 Command = ’ d e l ’ / / t r i m ( F i l e n a m e s ( j ) )
1282 C a l l SYSTEM( t r i m ( Command ) )
1283 End Do
1284
1285 Deallocate ( Filenames )
1286 D e a l l o c a t e ( SampleCode_T , DateTimeSamples_T , SamplingAwayTot_T , S a m p l i n g D e p t h T o t _ T ,
S a m p l i n g R i g h t T o t _ T , SourceAwayTot_T , S o u r c e D e p t h T o t _ T , S o u r c e R i g h t T o t _ T )
1287 D e a l l o c a t e ( SampleCode_DH , DateTimeSamples_DH , SamplingAwayTot_DH , SamplingDepthTot_DH ,
SamplingRightTot_DH , SourceAwayTot_DH , SourceDepthTot_DH , S o u r c e R i g h t T o t _ D H )
1288
1289 Close ( OutputSamplesLoc_T_Txt )
1290 C l o s e ( OutputSamplesLoc_DH_Txt )
1291
1292 End Do
1293
1294 C l o s e ( FormationsTNO )
1295 D e a l l o c a t e ( Sample_Code , Fm_No , Fm)
1296
1297 Case D e f a u l t
1298
1299 W r i t e ( * , ’ (A) ’ ) " Unknown O p t i o n , p r o g r a m i s t e r m i n a t e d . "
1300 Read ( * , * )
1301 Stop
1302
1303 End S e l e c t
1304
1305 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1306
1307 Write ( * , * )
1308 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1309 W r i t e ( * , ’ (A) ’ ) " The c h o s e n p a r t o f t h e p r o g r a m i s done , t o go b a c k t o t h e s t a r t t y p e ’ 1 ’ o r
t y p e ’0 ’ t o c l o s e t h e program : "
1310 Read ( * , * ) EndOption
1311
1312 S e l e c t Case ( E n d O p t i o n )
1313
230 F. Code of the MarsdiepVisual Program

1314 Case ( 0 )
1315
1316 Stop
1317
1318 Case ( 1 )
1319
1320 Write ( * , * )
1321 W r i t e ( * , ’ (A) ’ ) "
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− "
1322 Write ( * , * )
1323 Go t o 100
1324
1325 Case D e f a u l t
1326
1327 W r i t e ( * , ’ (A) ’ ) " Unknown o p t i o n p r o g r a m i s t e r m i n a t e d . "
1328 Read ( * , * )
1329 Stop
1330
1331 End S e l e c t
1332
1333 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1334
1335 End Program M a r s d i e p V i s u a l

Code/MarsdiepVisual.f90

1 Module V i s u a l M o d u l e
2
3 I m p l i c i t None
4
5 Contains
6
7 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
8 ! FUNCTIONS
9 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10
11 I n t e g e r Function LineCount ( F i l e )
12 ! C a l c u l a t e s t h e amount o f l i n e s i n a f i l e
13 ! Based on h t t p : / / web . u t a h . edu / t h o r n e / c o m p u t i n g / H a n d y _ F o r t r a n _ T r i c k s . pdf , b o t t o m l a s t p a g e
14 ! See h t t p : / / s t a c k o v e r f l o w . com / q u e s t i o n s / 1 9 7 1 3 2 0 7 / u s i n g −do − l o o p − i n −a − f o r t r a n 9 0 − program − t o −
r e a d − d i f f e r e n t − number − of − l i n e s − f o r −n − f r a f o r how t o c h a n g e t o column c o u n t .
15 I m p l i c i t None
16
17 Integer :: File , nlines
18 Integer :: io
19
20 nlines = 0 ! Number o f l i n e s n e e d s a s t a r t v a l u e
21
22 Do
23 Read ( F i l e , * , IOSTAT= i o )
24 I f ( i o > 0 ) Then
25 W r i t e ( * , * ) " Check i n p u t . S o m e t h i n g i s wrong . . . "
26 Exit
27 E l s e I f ( i o < 0 ) Then ! I o s t a t i s n e g a t i v e f o r end o f f i l e .
28 ! WRITE ( * , * ) " End o f f i l e i s r e a c h e d . " ! No l o n g e r n e c e s s a r y o n c e i t works .
29 Exit
30 Else
31 n l i n e s = n l i n e s +1
32 End I f
33 End Do
34
35 Rewind ( F i l e ) ! Reading of t h e d a t a s t a r t s a t t h e top of t h e f i l e again .
36
37 Linecount = nlines
38
39 End F u n c t i o n
40
41 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
42
43 I n t e g e r F u n c t i o n ColumnCount ( F i l e , S e p a r a t o r )
231

44 ! C o u n t s t h e number o f c o l u m n s i n a f i l e by c o u n t i n g t h e s e p a r a t o r s .
45 ! Assumed i s t h a t t h e f i l e h a s t h e same number o f c o l u m n s f o r e v e r y l i n e and t h a t t h e l i n e s
a r e s e p a r a t e d by a symbol which i s n o t e q u a l t o t h e d e c i m a l o r t h o u s a n d s i g n and n o t
e q u a l t o t h e symbol f o r empty s p a c e s i f t h o s a a r e p r e s e n t .
46 ! Based on h t t p : / / r o s e t t a c o d e . o r g / w i k i / C o u n t _ o c c u r r e n c e s _ o f _ a _ s u b s t r i n g # F o r t r a n
47 I m p l i c i t None
48
49 Integer :: File
50 Integer :: nSeparators
51 Character (*) :: Separator
52 Character (2048) :: Line
53 Integer :: Pos , posmin
54
55 Read ( F i l e , ’ (A) ’ ) L i n e
56
57 nSeparators = 0
58 Posmin = 1
59
60 Do ! I n f i n i t e loop , loop r u n s t i l l t h e command i s r e a c h e d t h a t c l o s e s i t .
61 Pos = I n d e x ( L i n e ( posmin : ) , S e p a r a t o r )
62
63 I f ( Pos == 0 ) Then ! EOF i s r e a c h e d , i n d e x r e t u r n s 0 i f s u b s t r i n g i s n o t f o u n d .
64 ColumnCount = nSeparators + 1 ! nColumns i s a c t u a l l y t h e number o f s e p a r a t o r s .
65 Rewind ( F i l e ) ! Reading of t h e d a t a s t a r t s a t t h e top of t h e f i l e again .
66 Return ! C l o s e s t h e do − l o o p and t h u s t h e f u n c t i o n .
67 End I f
68
69 nSeparators = nSeparators + 1
70 posmin = posmin + p o s + l e n ( S e p a r a t o r )
71 End Do
72
73 End F u n c t i o n
74
75 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
76
77 C h a r a c t e r ( 1 0 0 ) F u n c t i o n S h o r t ( Long )
78 ! E n a b l e s a s h o r t c u t t o a b b r e v i a t e d words .
79 I m p l i c i t None
80
81 Character (*) :: Long
82
83 S e l e c t Case ( Long )
84
85 Case ( ’ Den H e l d e r ’ )
86
87 Short = ’DH’
88
89 Case ( ’ T e x e l ’ )
90
91 Short = ’T ’
92
93 Case D e f a u l t
94
95 W r i t e ( * , ’ (A) ’ ) " T h e r e i s no programmed s h o r t f o r t h i s word . "
96
97 End S e l e c t
98
99 End F u n c t i o n
100
101 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
102
103 Real F u n c t i o n Average ( Vector )
104 ! C a l c u l a t e s t h e a v e r a g e o f an v e c t o r , e x c l u d i n g 0
105 I m p l i c i t None
106
107 Real :: Vector ( : )
108
109 A v e r a g e = Sum ( V e c t o r ) / Count ( V e c t o r > 0 )
110
111 End F u n c t i o n
112
232 F. Code of the MarsdiepVisual Program

113 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
114 ! SUBROUTINES
115 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
116 ! Reading i n
117 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
118
119 S u b r o u t i n e R e a d i n g F i l e C S V _ S u r ( F i l e , N l i n e s _ s u r , DateTime_Sur , J o i n t , CL ,MD, I n c l i n a t i o n R a w ,
AzimuthRaw , B t o t , Dip , E l e v a t i o n C a l c , ElevationMGS , Away , R_Calc , R_MGS)
120 ! C o n t a i n i n g h e a d e r , 1 s t column d a t e ( dd −mm− yy ) , 2 nd column t i m e ( hh :mm) , j u s t r e a l numbers
t h e o t h e r columns , b e s i d e s number 11 which c o n t a i n s i n t e g e r s . Columns s e p a r a t e d by " , " .
121 I m p l i c i t None
122
123 Integer :: File
124 Character (130) :: Header
125 Integer , allocatable :: Date_I ( : )
126 Real , allocatable :: Time_R ( : )
127 Integer , allocatable :: J o i nt ( : ) , Btot ( : )
128 Real , allocatable :: CL ( : ) ,MD( : ) , I n c l i n a t i o n R a w ( : ) , AzimuthRaw ( : )
129 Real , allocatable :: Dip ( : ) , ElevationMGS ( : )
130 Real ( 8 ) , allocatable :: ElevationCalc ( : )
131 Real ( 8 ) , allocatable :: R_Calc ( : )
132 Real ( 8 ) , allocatable :: Away ( : )
133 Real , allocatable :: R_MGS ( : )
134 Integer :: n l i n e s , i , io , n l i n e s _ d a t a , N l i n e s _ s u r
135 Character (19) , Allocatable :: DateTime_Sur ( : )
136
137 n l i n e s = LINECOUNT ( F i l e )
138
139 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
140
141 Write ( * , * )
142 W r i t e ( * , ’ (A, I7 , A) ’ ) " The S u r v e y f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g d a t a a r e
found . "
143
144 Allocate ( Date_I ( n l i n e s _ d a t a ) )
145 A l l o c a t e ( Time_R ( n l i n e s _ d a t a ) )
146 Allocate ( Joint ( nlines_data ) )
147 Allocate ( Btot ( nlines_data ) )
148 A l l o c a t e ( CL ( n l i n e s _ d a t a ) )
149 A l l o c a t e (MD( n l i n e s _ d a t a ) )
150 A l l o c a t e ( InclinationRAW ( n l i n e s _ d a t a ) )
151 A l l o c a t e ( AzimuthRaw ( n l i n e s _ d a t a ) )
152 A l l o c a t e ( Dip ( n l i n e s _ d a t a ) )
153 Allocate ( ElevationCalc ( nlines_data ) )
154 A l l o c a t e ( ElevationMGS ( n l i n e s _ d a t a ) )
155 A l l o c a t e ( Away ( n l i n e s _ d a t a ) )
156 A l l o c a t e ( R_Calc ( n l i n e s _ d a t a ) )
157 A l l o c a t e (R_MGS( n l i n e s _ d a t a ) )
158
159 Read ( f i l e , ’ ( A100 ) ’ ) Header
160
161 Do i =1 , n l i n e s _ d a t a −1 ! The " − 1" a c c o u n t s f o r t h e l i n e r e a d two l i n e s a b o v e t h i s s e n t e n c e
.
162 Read ( f i l e , ’ ( I5 , 1 x , F17 . 1 5 , 1 x , I , 9 ( F ) , F4 . 3 , F9 . 4 , F ) ’ , IOSTAT= i o ) D a t e _ I ( i ) , Time_R ( i ) , J o i n t ( i ) ,
CL ( i ) ,MD( i ) , I n c l i n a t i o n R a w ( i ) , AzimuthRaw ( i ) , B t o t ( i ) , Dip ( i ) , E l e v a t i o n C a l c ( i ) , ElevationMGS (
i ) , Away ( i ) , R_Calc ( i ) ,R_MGS( i )
163
164 I f ( i o > 0 ) Then
165 w r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
166 exit
167 E l s e i f ( i o < 0 ) Then
168 w r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . Some l i n e s may c o n t a i n no
data or rubbish . "
169 Exit
170 End I f
171 End Do
172
173 N l i n e s _ s u r = n l i n e s _ d a t a −1 ! The " − 1" i s t o a c c o u n t f o r s k i p p i n g t h e s e c o n d l i n e
174
175 C a l l DateTimeFromSur ( DateTime_Sur , D a t e _ I , Time_R , N l i n e s _ s u r )
176
233

177 D e a l l o c a t e ( D a t e _ I , Time_R )
178
179 End S u b r o u t i n e
180
181 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
182
183 S u b r o u t i n e R e a d i n g F i l e S a m p l e D a t a ( L o c a t i o n , F i l e , No_Samples , DateTime_Samples , Sample_ID , Temp , EC ,
pH , MF, Rho , SC , RPM_600 , RPM_300 , RPM_200 , RPM_100 , RPM_60 , RPM_30 , RPM_6 , RPM_3 , Gel10s , Gel10min )
184 ! C o n t a i n i n g h e a d e r , 1 s t column d a t e ( dd −mm− yy ) , 2 nd column t i m e ( hh :mm) , j u s t r e a l numbers
t h e o t h e r columns , b e s i d e s number 11 which c o n t a i n s i n t e g e r s . Columns s e p a r a t e d by " , " .
185 I m p l i c i t None
186
187 Integer :: File
188 Character (130) :: Header
189 Integer , Allocatable :: Date_I ( : )
190 Real , Allocatable : : Time_R ( : )
191 Integer :: n l i n e s , i , i o , n l i n e s _ d a t a , No_Samples
192 Character (19) , Allocatable :: DateTime_Samples ( : )
193 Character ( len =:) , Allocatable :: Sample_ID ( : )
194 Real , Allocatable : : Temp ( : ) ,EC ( : ) , pH ( : ) ,MF ( : ) , Rho ( : ) , SC ( : )
195 Integer , Allocatable : : RPM_600 ( : ) , RPM_300 ( : ) , RPM_200 ( : ) , RPM_100 ( : ) , RPM_60 ( : ) ,
RPM_30 ( : ) ,RPM_6 ( : ) ,RPM_3 ( : ) , G e l 1 0 s ( : ) , Gel10min ( : )
196 Character (10) :: Location
197
198 n l i n e s = LINECOUNT ( F i l e )
199
200 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
201
202 Write ( * , * )
203 W r i t e ( * , ’ (A, I7 , A) ’ ) " The Sample f i l e i s r e a d and " , n l i n e s _ d a t a , " l i n e s c o n t a i n i n g d a t a a r e
found . "
204
205 Allocate ( Date_I ( n l i n e s _ d a t a ) )
206 A l l o c a t e ( Time_R ( n l i n e s _ d a t a ) )
207
208 S e l e c t Case ( L o c a t i o n )
209 Case ( ’ Den H e l d e r ’ )
210 Allocate ( character (14) :: Sample_ID ( n l i n e s _ d a t a ) )
211
212 Case ( ’ T e x e l ’ )
213 Allocate ( character (11) :: Sample_ID ( n l i n e s _ d a t a ) )
214
215 Case D e f a u l t
216 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n i s unknown , p r o g r a m i s t e r m i n a t e d . "
217 Pause
218 Stop
219
220 End S e l e c t
221
222 A l l o c a t e ( Temp ( n l i n e s _ d a t a ) )
223 A l l o c a t e ( EC ( n l i n e s _ d a t a ) )
224 A l l o c a t e ( pH ( n l i n e s _ d a t a ) )
225 A l l o c a t e (MF( n l i n e s _ d a t a ) )
226 A l l o c a t e ( Rho ( n l i n e s _ d a t a ) )
227 A l l o c a t e ( SC ( n l i n e s _ d a t a ) )
228 A l l o c a t e ( RPM_600 ( n l i n e s _ d a t a ) )
229 A l l o c a t e ( RPM_300 ( n l i n e s _ d a t a ) )
230 A l l o c a t e ( RPM_200 ( n l i n e s _ d a t a ) )
231 A l l o c a t e ( RPM_100 ( n l i n e s _ d a t a ) )
232 A l l o c a t e ( RPM_60 ( n l i n e s _ d a t a ) )
233 A l l o c a t e ( RPM_30 ( n l i n e s _ d a t a ) )
234 A l l o c a t e ( RPM_6 ( n l i n e s _ d a t a ) )
235 A l l o c a t e ( RPM_3 ( n l i n e s _ d a t a ) )
236 A l l o c a t e ( Gel10s ( n l i n e s _ d a t a ) )
237 A l l o c a t e ( Gel10min ( n l i n e s _ d a t a ) )
238
239 Read ( f i l e , ’ ( A100 ) ’ ) Header
240
241 Do i =1 , n l i n e s _ d a t a
242 Read ( f i l e , ’ ( I5 , 1 x , F17 . 1 5 , 1 x , A, 1 x , 3 ( F5 . 2 , 1 x ) , F6 . 2 , 1 x , 2 ( F5 . 2 , 1 x ) , 1 0 ( I ) ) ’ , IOSTAT= i o ) D a t e _ I (
i ) , Time_R ( i ) , Sample_ID ( i ) , Temp ( i ) ,EC ( i ) , pH ( i ) ,MF( i ) , Rho ( i ) , SC ( i ) , RPM_600 ( i ) , RPM_300 ( i ) ,
234 F. Code of the MarsdiepVisual Program

RPM_200 ( i ) , RPM_100 ( i ) , RPM_60 ( i ) , RPM_30 ( i ) ,RPM_6 ( i ) ,RPM_3 ( i ) , G e l 1 0 s ( i ) , Gel10min ( i )


243
244 I f ( i o > 0 ) Then
245 W r i t e ( * , * ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
246 Exit
247 E l s e i f ( i o < 0 ) Then
248 W r i t e ( * , * ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . Some l i n e s may c o n t a i n no
data or rubbish . "
249 Exit
250 End I f
251 End Do
252
253 No_Samples = n l i n e s _ d a t a
254
255 C a l l DateTimeFromSur ( DateTime_Samples , D a t e _ I , Time_R , No_Samples )
256
257 D e a l l o c a t e ( D a t e _ I , Time_R )
258
259 End S u b r o u t i n e
260
261 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
262
263 S u b r o u t i n e R e a d i n g F i l e O u t p u t S a m p l e s L o c T x t ( L o c a t i o n , F i l e , SampleCode , DateTimeSamples ,
SamplingAwayTot , S a m p l i n g D e p t h T o t , S a m p l i n g R i g h t T o t , SourceAwayTot , S o u r c e D e p t h T o t ,
SourceRightTot )
264 ! Reads t h e r e s u l t s from t h e s a m p l e s o u r c e p r o g r a m r e l a t e d t o T e x e l .
265 I m p l i c i t None
266
267 Integer :: File
268 Character (19) , Allocatable :: DateTimeSamples ( : )
269 Character ( len =:) , Allocatable :: SampleCode ( : )
270 Character (*) :: Location
271 Integer :: nlines , nlines_data , i , io
272 Integer , Allocatable : : MainI ( : )
273 Real , Allocatable : : S o u r c e L o c _ S u r ( : ) , SourceLoc_PD ( : ) , SourceLocAv ( : )
274 Real , Allocatable : : S a m p l i n g D e p t h T o t ( : ) , SamplingAwayTot ( : ) , S a m p l i n g R i g h t T o t
(:)
275 Real , Allocatable : : S o u r c e D e p t h T o t ( : ) , SourceAwayTot ( : ) , S o u r c e R i g h t T o t ( : )
276 Real , Allocatable : : PositionBitAll (:)
277
278 nlines = Linecount ( File )
279
280 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
281
282 W r i t e ( * , ’ (A, I3 , A) ’ ) ’ The o u t p u t ’ / / t r i m ( L o c a t i o n ) / / ’ f i l e i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s
c o n t a i n i n g d a t a a r e found . ’
283
284 A l l o c a t e ( DateTimeSamples ( n l i n e s _ d a t a ) )
285
286 S e l e c t Case ( L o c a t i o n )
287 Case ( ’ Den H e l d e r ’ )
288 Allocate ( character (14) :: SampleCode ( n l i n e s _ d a t a ) )
289
290 Case ( ’ T e x e l ’ )
291 Allocate ( character (11) :: SampleCode ( n l i n e s _ d a t a ) )
292
293 Case D e f a u l t
294 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n i s unknown , p r o g r a m i s t e r m i n a t e d . "
295 Pause
296 Stop
297
298 End S e l e c t
299
300 A l l o c a t e ( MainI ( n l i n e s _ d a t a ) )
301 A l l o c a t e ( SourceLoc_Sur ( n l i n e s _ d a t a ) )
302 A l l o c a t e ( SourceLoc_PD ( n l i n e s _ d a t a ) )
303 A l l o c a t e ( SourceLocAv ( n l i n e s _ d a t a ) )
304 A l l o c a t e ( SamplingDepthTot ( n l i n e s _ d a t a ) )
305 A l l o c a t e ( SamplingAwayTot ( n l i n e s _ d a t a ) )
306 Allocate ( SamplingRightTot ( n l i n e s _ d a t a ) )
307 A l l o c a t e ( SourceDepthTot ( n l i n e s _ d a t a ) )
235

308 A l l o c a t e ( SourceAwayTot ( n l i n e s _ d a t a ) )
309 Allocate ( SourceRightTot ( nlines_data ) )
310 Allocate ( PositionBitAll ( nlines_data ) )
311
312 Read ( F i l e , * ) ! Skips headers .
313
314 Do i = 1 , n l i n e s _ d a t a
315 Read ( F i l e , ’ ( 2 (A) , 6 ( F ) ) ’ , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , SamplingAwayTot ( i ) ,
S a m p l i n g D e p t h T o t ( i ) , S a m p l i n g R i g h t T o t ( i ) , SourceAwayTot ( i ) , S o u r c e D e p t h T o t ( i ) , S o u r c e R i g h t T o t
(i)
316
317 I f ( i o > 0 ) Then
318 W r i t e ( * , ’ (A) ’ ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
319 Exit
320 E l s e i f ( i o < 0 ) Then
321 W r i t e ( * , ’ (A) ’ ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . Some l i n e s may c o n t a i n no
data or rubbish . "
322 Exit
323 End i f
324
325 End Do
326
327 End S u b r o u t i n e
328
329 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
330
331 S u b r o u t i n e R e a d i n g F i l e S i e v e ( F i l e , Sample_Code , D)
332 ! Reads t h e s i e v e f i l e , c a n be g e n e r a l i z e d t o be a p p l i c a b l e t o f i l e s w i t h v a r i a b l e p a r a m e t e r
lengths .
333 I m p l i c i t None
334
335 Integer :: File
336 Integer :: n l i n e s , n l i n e s _ d a t a , i , io , j
337 Character (31) , Allocatable :: GefFileName ( : )
338 Character (7) , Allocatable :: Boring_Code ( : )
339 Character (3) , Allocatable : : NEN5104_Code ( : )
340 Character (7) , Allocatable : : Sample_No ( : )
341 Character (14) , Allocatable : : Sample_Code ( : )
342 Character (17) , Allocatable :: Depth ( : )
343 Character (1) :: lineTemp
344 Character (2048) :: Line
345 Integer : : Posmin , Posmax , Pos
346 Character (40) , Allocatable : : Var ( : )
347 Character :: Separator
348 Integer : : nColumns
349 Character (2) : : Number
350 Character (7) : : Code
351 Real , Allocatable : : D( : , : )
352 Integer : : count
353
354 n l i n e s = LineCount ( F i l e )
355 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
356
357 A l l o c a t e (D( n l i n e s _ d a t a , 9 9 ) ) ! (y , x)
358
359 Separator = " , "
360 nColumns = ColumnCount ( F i l e , S e p a r a t o r )
361
362 W r i t e ( * , * ) " ColumnCount : " , nColumns
363
364 Write ( * , * )
365 W r i t e ( * , ’ (A, I7 , A) ’ ) ’ The S i e v e f i l e i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s c o n t a i n i n g d a t a a r e
found . ’
366
367 A l l o c a t e ( Var ( nColumns ) )
368 A l l o c a t e ( GefFileName ( n l i n e s _ d a t a ) )
369 A l l o c a t e ( Boring_Code ( n l i n e s _ d a t a ) )
370 A l l o c a t e ( NEN5104_Code ( n l i n e s _ d a t a ) )
371 A l l o c a t e ( Sample_No ( n l i n e s _ d a t a ) )
372 A l l o c a t e ( Sample_Code ( n l i n e s _ d a t a ) )
373 A l l o c a t e ( Depth ( n l i n e s _ d a t a ) )
236 F. Code of the MarsdiepVisual Program

374
375 Read ( F i l e , ’ (A) ’ ) ! Skips headers
376
377 Do j = 1 , n l i n e s _ d a t a
378 Read ( F i l e , ’ (A) ’ ) L i n e
379
380 posmin = 1
381 posmax = −1
382 Count = 0
383
384 Do i =1 , nColumns
385
386 Pos = i n d e x ( L i n e ( Posmin : ) , " , " )
387 I f ( Pos == 0 ) Then
388 Var ( i ) = L i n e ( Posmin : )
389 ! W r i t e ( * , ’ ( A, I4 , A, A, A, I5 , A, I 5 ) ’ ) " i , Var ( i ) , Posmin , Posmax : " , i , " , " , t r i m ( Var ( i )
) , " , " , Posmin , " , " , Posmax
390 Exit
391 End I f
392
393 Count = c o u n t + 1
394 ! I f ( i == 1 0 ) P a u s e
395
396 I f ( Count == 5 ) e x i t
397
398 Posmax = Posmax + Pos
399 Var ( i ) = L i n e ( Posmin : Posmax )
400 Posmin = Posmin + Pos
401
402 End Do
403
404 Read ( Var ( 2 ) , ’ (A) ’ ) Boring_Code ( j )
405 Read ( Var ( 3 ) , ’ (A) ’ ) NEN5104_Code ( j )
406 Read ( Var ( 4 ) , ’ (A) ’ ) Sample_No ( j )
407
408 ! G i v i n g t h e g e f r e s u l t s t h e same c o d e a s u s e d i n t h e o t h e r f i l e s .
409
410 Code = Sample_No ( j )
411 Read ( Code ( Len ( t r i m ( Code ) ) − 1 : ) , ’ ( A2 ) ’ ) Number
412
413 I f ( I n d e x ( B o r i n g _ C o d e ( j ) , "A1" ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "DH" ) > 0 ) Then
414 Sample_Code ( j ) = "PB1DH−A1−65− " / / Number
415 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , "A3" ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "DH" ) > 0 ) Then
416 Sample_Code ( j ) = "PB1DH−A3−85− " / / Number
417 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , " B65 " ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "TXL" ) > 0 ) Then
418 Sample_Code ( j ) = "B−65−TXL− " / / Number
419 E l s e I f ( I n d e x ( B o r i n g _ C o d e ( j ) , " C85 " ) > 0 . and . I n d e x ( B o r i n g _ C o d e ( j ) , "TXL" ) > 0 ) Then
420 Sample_Code ( j ) = "C−85−TXL− " / / Number
421 Else ! The v e r t i c a l f i l e o r o t h e r f i l e s .
422 Sample_Code ( j ) = t r i m ( B o r i n g _ C o d e ( j ) ) / / " − " / / t r i m ( Sample_No ( j ) )
423 ! W r i t e ( * , * ) Sample_Code ( j )
424 End I f
425
426 End Do
427
428 Rewind ( F i l e )
429
430 Read ( F i l e , * ) ! Skips headers
431 Do j = 1 , n L i n e s _ d a t a
432 count = 0
433 Do While ( . TRUE . )
434 Read ( F i l e , ’ (A) ’ , Advance = ’No ’ ) l i n e T e m p
435 ! W r i t e ( * , ’ (A) ’ ) l i n e T e m p
436 I f ( l i n e T e m p == ’ , ’ ) c o u n t = c o u n t + 1
437 I f ( c o u n t == 5 ) e x i t
438 End Do
439
440 Read ( F i l e , * ) D( j , : )
441 End Do
442
443 End S u b r o u t i n e
237

444
445 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
446
447 S u b r o u t i n e R e a d i n g F i l e S i e v e V 2 ( F i l e , Sample_Code , D)
448 ! Reads t h e s i e v e f i l e V2 , c a n be g e n e r a l i z e d t o be a p p l i c a b l e t o f i l e s w i t h v a r i a b l e
parameter lengths .
449 I m p l i c i t None
450
451 Integer :: File
452 Integer :: n l i n e s , n l i n e s _ d a t a , i , io , j
453 Character (31) , Allocatable :: GefFileName ( : )
454 Character (7) , Allocatable :: Boring_Code ( : )
455 Character (3) , Allocatable :: NEN5104_Code ( : )
456 Character (7) , Allocatable :: Sample_No ( : )
457 Character (14) , Allocatable :: Sample_Code ( : )
458 Character (17) , Allocatable :: Depth ( : )
459 Character (1) :: lineTemp
460 Character (2048) :: Line
461 Integer :: Posmin , Posmax , Pos
462 Character (40) , Allocatable :: Var ( : )
463 Character :: Separator
464 Integer :: nColumns
465 Character (2) :: Number
466 Character (7) :: Code
467 Real , Allocatable :: D( : , : )
468 Integer :: count
469 Real , Allocatable :: Mass_Sand ( : )
470 Character (6) , Allocatable :: Sieve_Code ( : )
471 Real , Allocatable :: Avg_GrainSize ( : )
472 Character :: Temp
473 Character (2) :: Temp2
474
475 n l i n e s = LineCount ( F i l e )
476 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
477
478 A l l o c a t e (D( n l i n e s _ d a t a , 9 9 ) ) ! (y , x)
479
480 Separator = " , "
481 nColumns = ColumnCount ( F i l e , S e p a r a t o r )
482
483 Write ( * , * )
484 W r i t e ( * , ’ (A, I7 , A) ’ ) ’ The S i e v e f i l e V2 i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s c o n t a i n i n g d a t a a r e
found . ’
485
486 A l l o c a t e ( Var ( nColumns ) )
487 A l l o c a t e ( Sieve_Code ( n l i n e s _ d a t a ) )
488 A l l o c a t e ( Mass_Sand ( n l i n e s _ d a t a ) )
489 Allocate ( Avg_Grainsize ( n l i n e s _ d a t a ) )
490 A l l o c a t e ( Sample_No ( n l i n e s _ d a t a ) )
491 A l l o c a t e ( Sample_Code ( n l i n e s _ d a t a ) )
492
493 Read ( F i l e , ’ (A) ’ ) ! Skips headers
494
495 Do j = 1 , n l i n e s _ d a t a
496 Read ( F i l e , ’ (A) ’ ) L i n e
497
498 posmin = 1
499 posmax = −1
500 Count = 0
501
502 Do i =1 ,6
503
504 Pos = i n d e x ( L i n e ( Posmin : ) , " , " )
505 I f ( Pos == 0 ) Then
506 Var ( i ) = L i n e ( Posmin : )
507 ! W r i t e ( * , ’ ( A, I4 , A, A, A, I5 , A, I 5 ) ’ ) " i , Var ( i ) , Posmin , Posmax : " , i , " , " , t r i m ( Var ( i )
) , " , " , Posmin , " , " , Posmax
508 Exit
509 End I f
510
511 Count = c o u n t + 1
238 F. Code of the MarsdiepVisual Program

512
513 Posmax = Posmax + Pos
514 Var ( i ) = L i n e ( Posmin : Posmax )
515 Posmin = Posmin + Pos
516
517 I f ( Count == 4 ) e x i t
518
519 End Do
520
521 Read ( Var ( 1 ) , ’ (A) ’) Sieve_Code ( j )
522 Read ( Var ( 2 ) , ’ (A) ’) Sample_Code ( j )
523 Read ( Var ( 3 ) , ’ (F) ’) Mass_Sand ( j )
524 Read ( Var ( 4 ) , ’ (F) ’) Avg_Grainsize ( j )
525
526 End Do
527
528 Rewind ( F i l e )
529
530 Read ( F i l e , * ) ! Skips headers
531 Do j = 1 , n L i n e s _ d a t a
532 count = 0
533 Do While ( . TRUE . )
534 Read ( F i l e , ’ (A) ’ , Advance = ’No ’ ) l i n e T e m p
535 I f ( l i n e T e m p == ’ , ’ ) c o u n t = c o u n t + 1
536 I f ( c o u n t == 4 ) e x i t
537 End Do
538
539 Read ( F i l e , * ) D( j , : )
540 End Do
541
542 D e a l l o c a t e ( Var )
543
544 End S u b r o u t i n e
545
546 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
547
548 S u b r o u t i n e R e a d i n g F i l e F o r m a t i o n s ( F i l e , Sample_Code , Fm_No , Fm)
549 ! Reads t h e f i l e w i t h f o r m a t i o n s a s s i g n e d by TNO
550 I m p l i c i t None
551
552 Integer :: n l i n e s , n l i n e s _ d a t a , i , i o , IOSTAT , j
553 Integer :: File
554 Integer , A l l o c a t a b l e : : Fm_No ( : )
555 Character (100) , A l l o c a t a b l e : : Fm ( : )
556 Character (14) , A l l o c a t a b l e : : Sample_Code ( : )
557 Character :: Separator
558 Integer : : nColumns , Count
559 Character (1) :: lineTemp
560 Character (2048) :: Line
561 Integer : : Posmin , Posmax , Pos
562 Character (40) , A l l o c a t a b l e : : Var ( : )
563
564 n l i n e s = LineCount ( F i l e )
565 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
566
567 Separator = " , "
568 nColumns = ColumnCount ( F i l e , S e p a r a t o r )
569
570 Write ( * , * )
571 W r i t e ( * , ’ (A, I3 , A) ’ ) ’ The F o r m a t i o n TNO f i l e i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s c o n t a i n i n g d a t a
a r e found . ’
572
573 A l l o c a t e ( Fm_No ( n l i n e s _ d a t a ) )
574 A l l o c a t e (Fm( n l i n e s _ d a t a ) )
575 A l l o c a t e ( Sample_Code ( n l i n e s _ d a t a ) )
576 A l l o c a t e ( Var ( nColumns ) )
577
578 Read ( F i l e , * ) ! Skips headers .
579
580 Do j = 1 , n l i n e s _ d a t a
581 Read ( F i l e , ’ (A) ’ ) L i n e
239

582
583 posmin = 1
584 posmax = −1
585 Count = 0
586
587 Do i =1 ,6
588
589 Pos = i n d e x ( L i n e ( Posmin : ) , " , " )
590 I f ( Pos == 0 ) Then
591 Var ( i ) = L i n e ( Posmin : )
592 ! W r i t e ( * , ’ ( A, I4 , A, A, A, I5 , A, I 5 ) ’ ) " i , Var ( i ) , Posmin , Posmax : " , i , " , " , t r i m ( Var ( i )
) , " , " , Posmin , " , " , Posmax
593 Exit
594 End I f
595
596 Count = c o u n t + 1
597
598 Posmax = Posmax + Pos
599 Var ( i ) = L i n e ( Posmin : Posmax )
600 Posmin = Posmin + Pos
601
602 I f ( Count == 2 ) e x i t
603
604 End Do
605
606 Read ( Var ( 1 ) , ’ (A) ’ ) Sample_Code ( j )
607
608 Read ( Var ( 2 ) , ’ ( I ) ’ ) Fm_No ( j )
609
610 End Do
611
612 Rewind ( F i l e )
613
614 Read ( F i l e , * ) ! Skips headers
615 Do j = 1 , n L i n e s _ d a t a
616 count = 0
617 Do While ( . TRUE . )
618 Read ( F i l e , ’ (A) ’ , Advance = ’No ’ ) l i n e T e m p
619 I f ( l i n e T e m p == ’ , ’ ) c o u n t = c o u n t + 1
620 I f ( c o u n t == 2 ) e x i t
621 End Do
622
623 Read ( F i l e , * ) Fm( j )
624 End Do
625
626 D e a l l o c a t e ( Var )
627
628 End S u b r o u t i n e
629
630 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
631
632 S u b r o u t i n e R e a d i n g F i l e O u t p u t T x t ( L o c a t i o n , F i l e , Var , SampleCode , DateTimeSamples , Col01 , Col02 ,
Col03 , Col04 , Col05 , Col06 , Col07 , Col08 , Col09 , Col10 , Col11 , Col12 , Col13 , Col14 , Col15 , Col16 , Col17
, Col18 )
633 ! G e n e r a l i z e d r e a d i n g s u b r o u t i n e , r e a d f i l e w i t h h e a d e r and s a m p l e c o d e i n t h e 1 s t column ,
d a t e t i m e s a m p l e i n t h e s e c o n d column , o t h e r c o l u m n s a r e u n s p e c i f i e d b u t o f t h e r e a l t y p e .
634 I m p l i c i t None
635
636 Integer :: File
637 Character (19) , Allocatable :: DateTimeSamples ( : )
638 Character ( len =:) , A l l o c a t a b l e : : SampleCode ( : )
639 Character (*) :: Location
640 Integer :: nlines , nlines_data , i , io
641 Real , Allocatable : : Col01 ( : ) , Col02 ( : ) , Col03 ( : ) , Col04 ( : ) , Col05 ( : ) , Col06 ( : )
642 Real , O p t i o n a l , Allocatable : : Col07 ( : ) , Col08 ( : ) , Col09 ( : ) , Col10 ( : ) , Col11 ( : ) , Col12 ( : )
643 Real , O p t i o n a l , Allocatable : : Col13 ( : ) , Col14 ( : ) , Col15 ( : ) , Col16 ( : ) , Col17 ( : ) , Col18 ( : )
644 Character :: Separator
645 Integer : : nColumns , Count
646 Character (1) :: lineTemp
647 Character (2048) :: Line
648 Integer : : Posmin , Posmax , Pos
240 F. Code of the MarsdiepVisual Program

649 Character (40) , Allocatable :: Var ( : )


650
651 nlines = Linecount ( File )
652 n l i n e s _ d a t a = n l i n e s −1 ! File contains headers .
653
654 Separator = " , "
655 nColumns = ColumnCount ( F i l e , S e p a r a t o r )
656
657 S e l e c t Case ( L o c a t i o n )
658 Case ( ’ Den H e l d e r ’ )
659 Allocate ( character (14) :: SampleCode ( n l i n e s _ d a t a ) )
660
661 Case ( ’ T e x e l ’ )
662 Allocate ( character (11) :: SampleCode ( n l i n e s _ d a t a ) )
663
664 Case D e f a u l t
665 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n i s unknown , p r o g r a m i s t e r m i n a t e d . "
666 Pause
667 Stop
668
669 End S e l e c t
670
671 A l l o c a t e ( DateTimeSamples ( n l i n e s _ d a t a ) )
672 A l l o c a t e ( Var ( nColumns ) )
673 A l l o c a t e ( Col01 ( n l i n e s _ d a t a ) )
674 A l l o c a t e ( Col02 ( n l i n e s _ d a t a ) )
675 A l l o c a t e ( Col03 ( n l i n e s _ d a t a ) )
676 A l l o c a t e ( Col04 ( n l i n e s _ d a t a ) )
677 A l l o c a t e ( Col05 ( n l i n e s _ d a t a ) )
678 A l l o c a t e ( Col06 ( n l i n e s _ d a t a ) )
679 I f ( P r e s e n t ( Col07 ) ) A l l o c a t e ( Col07 ( n l i n e s _ d a t a ))
680 I f ( P r e s e n t ( Col08 ) ) A l l o c a t e ( Col08 ( n l i n e s _ d a t a ))
681 I f ( P r e s e n t ( Col09 ) ) A l l o c a t e ( Col09 ( n l i n e s _ d a t a ))
682 I f ( P r e s e n t ( Col10 ) ) A l l o c a t e ( Col10 ( n l i n e s _ d a t a ))
683 I f ( P r e s e n t ( Col11 ) ) A l l o c a t e ( Col11 ( n l i n e s _ d a t a ))
684 I f ( P r e s e n t ( Col12 ) ) A l l o c a t e ( Col12 ( n l i n e s _ d a t a ))
685 I f ( P r e s e n t ( Col13 ) ) A l l o c a t e ( Col13 ( n l i n e s _ d a t a ))
686 I f ( P r e s e n t ( Col14 ) ) A l l o c a t e ( Col14 ( n l i n e s _ d a t a ))
687 I f ( P r e s e n t ( Col15 ) ) A l l o c a t e ( Col15 ( n l i n e s _ d a t a ))
688 I f ( P r e s e n t ( Col16 ) ) A l l o c a t e ( Col16 ( n l i n e s _ d a t a ))
689 I f ( P r e s e n t ( Col17 ) ) A l l o c a t e ( Col17 ( n l i n e s _ d a t a ))
690 I f ( P r e s e n t ( Col18 ) ) A l l o c a t e ( Col18 ( n l i n e s _ d a t a ))
691
692 Read ( F i l e , ’ (A) ’ ) L i n e
693
694 posmin = 1
695 posmax = −1
696 Count = 0
697
698 Do i =1 , nColumns
699
700 Pos = i n d e x ( L i n e ( Posmin : ) , " , " )
701 I f ( Pos == 0 ) Then
702 Var ( i ) = L i n e ( Posmin : )
703 ! W r i t e ( * , ’ ( A, I4 , A, A, A, I5 , A, I 5 ) ’ ) " i , Var ( i ) , Posmin , Posmax : " , i , " , " , t r i m ( Var ( i ) ) , " ,
" , Posmin , " , " , Posmax
704 Exit
705 End I f
706
707 Count = c o u n t + 1
708
709 Posmax = Posmax + Pos
710 Var ( i ) = L i n e ( Posmin : Posmax )
711 Posmin = Posmin + Pos
712 End Do
713
714 Do i = 1 , n l i n e s _ d a t a
715
716 I f ( P r e s e n t ( Col18 ) ) Then
717 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
241

, Col14 ( i ) , Col15 ( i ) , Col16 ( i ) , Col17 ( i ) , Col18 ( i )


718 E l s e I f ( P r e s e n t ( Col17 ) ) Then
719 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
, Col14 ( i ) , Col15 ( i ) , Col16 ( i ) , Col17 ( i )
720 E l s e I f ( P r e s e n t ( Col16 ) ) Then
721 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
, Col14 ( i ) , Col15 ( i ) , Col16 ( i )
722 E l s e I f ( P r e s e n t ( Col15 ) ) Then
723 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
, Col14 ( i ) , Col15 ( i )
724 E l s e I f ( P r e s e n t ( Col14 ) ) Then
725 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
, Col14 ( i )
726 E l s e I f ( P r e s e n t ( Col13 ) ) Then
727 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i ) , Col13 ( i )
728 E l s e I f ( P r e s e n t ( Col12 ) ) Then
729 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i ) , Col12 ( i )
730 E l s e I f ( P r e s e n t ( Col11 ) ) Then
731 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i ) , Col11 ( i )
732 E l s e I f ( P r e s e n t ( Col10 ) ) Then
733 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i ) , Col10 ( i )
734 E l s e I f ( P r e s e n t ( Col09 ) ) Then
735 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i ) , Col09 ( i )
736 E l s e I f ( P r e s e n t ( Col08 ) ) Then
737 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i ) , Col08 ( i )
738 E l s e I f ( P r e s e n t ( Col07 ) ) Then
739 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i ) , Col07 ( i )
740 Else
741 Read ( F i l e , * , IOSTAT= i o ) SampleCode ( i ) , D a t e T i m e S a m p l e s ( i ) , Col01 ( i ) , Col02 ( i ) , Col03 ( i ) ,
Col04 ( i ) , Col05 ( i ) , Col06 ( i )
742 End I f
743
744 I f ( i o > 0 ) Then
745 W r i t e ( * , ’ (A) ’ ) " Check i n p u t , s o m e t h i n g i s wrong , u n i t w i s e . . . "
746 Exit
747 E l s e i f ( i o < 0 ) Then
748 W r i t e ( * , ’ (A) ’ ) " End o f f i l e i s r e a c h e d , b e f o r e end o f l o o p . Some l i n e s may c o n t a i n no
data or rubbish . "
749 Exit
750 End i f
751
752 End Do
753
754 Write ( * , * )
755 W r i t e ( * , ’ (A, I4 , A) ’ ) ’ The o u t p u t ’ / / t r i m ( L o c a t i o n ) / / ’ f i l e i s r e a d and ’ , n l i n e s _ d a t a , ’ l i n e s
c o n t a i n i n g d a t a a r e found . ’
756
757 End S u b r o u t i n e
758
759 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
760 ! Conversion Subroutines
761 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
762
763 S u b r o u t i n e DateTimeFromSur ( DateTime_Sur , D a t e _ I , Time_R , N l i n e s _ s u r )
764 ! C o n v e r t s t h e D a t e _ I en Time_R t o one v e c t o r , which c a n be s e a r c h e d and h a s t h e same
f o r m a t a s t h e one r e a d from P r o d a t a .
765 ! The c o n v e r s i o n from e x c e l no . t o dd /mm/ yyyy i s p a r t i a l l y b a s e d on h t t p : / / www. c o d e p r o j e c t .
com / A r t i c l e s / 2 7 5 0 / E x c e l − s e r i a l − d a t e − t o −Day−Month − Year − and − v i s e − v e r s a
766 I m p l i c i t None
767
242 F. Code of the MarsdiepVisual Program

768 Character (19) , Allocatable :: DateTime_Sur ( : )


769 Integer (2) , Allocatable :: Day_L ( : ) , Month_L ( : ) , Hours_L ( : ) , M i n u t e s _ L ( : ) , Seconds_L ( : )
770 Integer (4) , Allocatable :: Year_L ( : )
771 Integer :: i , j , Nlines_sur
772 Integer :: Date_I ( : )
773 Real :: Time_R ( : )
774 Real :: l ,n,z ,y
775
776 A l l o c a t e ( Day_L ( N l i n e s _ s u r ) )
777 A l l o c a t e ( Month_L ( N l i n e s _ s u r ) )
778 A l l o c a t e ( Year_L ( N l i n e s _ s u r ) )
779 A l l o c a t e ( Hours_L ( N l i n e s _ s u r ) )
780 A l l o c a t e ( Minutes_L ( N l i n e s _ s u r ) )
781 A l l o c a t e ( Seconds_L ( N l i n e s _ s u r ) )
782 A l l o c a t e ( DateTime_Sur ( N l i n e s _ s u r ) )
783
784 Do i =1 , N l i n e s _ S u r
785
786 I f ( D a t e _ I ( i ) == 6 0 ) Then
787 Day_L = 29
788 Month_L = 2
789 Year_L = 1900
790
791 Else
792 I f ( D a t e _ I ( i ) < 6 0 ) Then
793 D a t e _ I ( i ) = D a t e _ I ( i ) +1
794 End I f
795
796 l = D a t e _ I ( i ) + 68569 + 2415019
797
798 n = f l o o r ( ( 4 * l ) / 146097)
799 l = l − f l o o r ( ( 146097 * n + 3 ) / 4 )
800
801 z = f l o o r ( ( 4000 * ( l + 1 ) ) / 1 4 6 1 0 0 1 )
802 l = l − f l o o r ( ( 1461 * z ) / 4 ) + 31
803 y = f l o o r ( ( 80 * l ) / 2 4 4 7 )
804
805 Day_L = l − f l o o r ( ( 2447 * y ) / 8 0 )
806
807 l = f l o o r ( y / 11)
808
809 Month_L = y + 2 − ( 12 * l )
810 Year_L = 100 * ( n − 49 ) + z + l
811 End I f
812
813 Hours_L ( i ) = i n t ( mod ( Time_R ( i ) * 2 4 . 0 , 6 0 . 0 ) )
814 Minutes_L ( i ) = i n t ( mod ( Time_R ( i ) * 1 4 4 0 . 0 , 6 0 . 0 ) )
815 Seconds_L ( i ) = n i n t ( mod ( Time_R ( i ) * 8 6 4 0 0 . 0 , 6 0 . 0 ) ) ! Due t o p o s s i b l e e r r o r s when
taking the only the i n t e g e r p a r t f o r seconds , the seconds are rounded towards the n e a r e s t
integer .
816
817 I f ( Seconds_L ( i ) == 6 0 ) Then ! A d d i t i o n a l s e c u r i t y measure , t o
assure r e a l i s t i c values .
818 Minutes_L ( i ) = Minutes_L ( i ) + 1
819 Seconds_L ( i ) = 0
820 End I f
821
822 W r i t e ( D a t e T i m e _ S u r ( i ) , ’ ( I 2 . 2 , A1 , I 2 . 2 , A1 , I4 , 1 x , I 2 . 2 , A1 , I 2 . 2 , A1 , I 2 . 2 ) ’ ) Day_L ( i ) , " − " , Month_L ( i )
, " − " , Year_L ( i ) , Hours_L ( i ) , " : " , M i n u t e s _ L ( i ) , " : " , Seconds_L ( i )
823
824 End Do
825
826 End S u b r o u t i n e
827
828 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
829
830 S u b r o u t i n e ZoomGPHours ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , Y)
831 ! C a l c u l a t e s t h e t i m e i n s e c o n d s t o HH:MM: SS
832 I m p l i c i t None
833
834 Character (19) :: D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax
243

835 Integer :: Y
836
837 Integer (2) :: Hours , Hours_Min , Hours_Max
838 Integer (2) :: Day , Day_Min , Day_Max
839 Integer (2) :: Month , Month_Min , Month_Max
840 Integer (4) :: Year
841 Integer (2) :: Minutes , Seconds
842
843
844 Read ( D a t e T i m e S o u r c e , ’ ( I2 , 1 x , I2 , 1 x , I4 , 1 x , I2 , 1 x , I2 , 1 x , I 2 ) ’ ) Day , Month , Year , Hours , M i n u t e s ,
Seconds
845
846 Hours_Min = Hours − 2 *Y
847 Day_Min = Day
848 Month_Min = Month
849
850 I f ( Hours_Min < 0 ) Then
851 Hours_Min = 24 + Hours_min
852 Day_Min = Day_Min − 1
853 End I f
854
855 ! Day_Min c a n become 0 o r l e s s s o t h a n t h e month h a s t o be r e d u c e d and day_min becomes t h e
l a s t o r t h e x t o l a s t day o f t h a t month .
856 I f ( Day_Min < 1 ) Then
857 I f ( ( Month − 1) == 1 . o r . ( Month − 1) == 3 . o r . ( Month − 1) == 5 . o r . ( Month − 1) == 7 . o r . (
Month − 1) == 8 . o r . ( Month − 1) == 10 . o r . ( Month − 1) == 1 2 ) Then
858 Day_Min = 31 + Day_Min
859 Month_Min = Month − 1
860 E l s e I f ( ( Month − 1) == 4 . o r . ( Month − 1) == 6 . o r . ( Month − 1) == 9 . o r . ( Month − 1) == 1 1 )
Then
861 Day_Min = 30 + Day_Min
862 Month_Min = Month − 1
863 E l s e I f ( ( Month − 1) == 2 ) Then
864 Day_Min = 28 + Day_Min
865 Month_Min = Month − 1
866 End I f
867 End I f
868
869 W r i t e ( DateTimeMin , ’ ( 2 ( I 2 . 2 , A1 ) , I4 , 1 x , 2 ( I 2 . 2 , A1 ) , I 2 . 2 ) ’ ) Day_Min , " − " , Month_Min , " − " , Year ,
Hours_Min , " : " , M i n u t e s , " : " , S e c o n d s
870
871 Hours_Max = Hours + Y
872 Day_Max = Day
873 Month_Max = Month
874
875 I f ( Hours_Max > 2 3 ) Then ! 2 3 : 5 9 becomes 0 0 : 0 0 t h e n e x t day
876 Hours_Max = Hours_Max − 24
877 Day_Max = Day_Max + 1
878 End I f
879
880 I f ( Day_Max > 3 1 ) Then
881 I f ( ( Month ) == 1 . o r . ( Month ) == 3 . o r . ( Month ) == 5 . o r . ( Month ) == 7 . o r . ( Month ) == 8
. o r . ( Month ) == 10 . o r . ( Month ) == 1 2 ) Then
882 Day_Max = Day_Max − 31
883 Month_Max = Month + 1
884 E l s e I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
885 Day_Max = Day_Max − 30
886 Month_Max = Month + 1
887 E l s e I f ( ( Month ) == 2 ) Then
888 Day_Max = Day_Max − 28
889 Month_Max = Month + 1
890 End I f
891 E l s e I f ( Day_Max > 3 0 ) Then
892 I f ( ( Month ) == 4 . o r . ( Month ) == 6 . o r . ( Month ) == 9 . o r . ( Month ) == 1 1 ) Then
893 Day_Max = Day_Max − 30
894 Month_Max = Month + 1
895 E l s e I f ( ( Month ) == 2 ) Then
896 Day_Max = Day_Max − 28
897 Month_Max = Month + 1
898 End I f
899 E l s e I f ( Day_Max > 2 8 ) Then
244 F. Code of the MarsdiepVisual Program

900 I f ( Month == 2 ) Then


901 Day_Max = Day_Max − 28
902 Month_Max = Month + 1
903 End I f
904 End I f
905
906 W r i t e ( DateTimeMax , ’ ( 2 ( I 2 . 2 , A1 ) , I4 , 1 x , 2 ( I 2 . 2 , A1 ) , I 2 . 2 ) ’ ) Day_Max , " − " , Month_Max , " − " , Year ,
Hours_Max , " : " , M i n u t e s , " : " , S e c o n d s
907
908 End S u b r o u t i n e
909
910 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
911 ! Plotting the data
912 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
913
914 S u b r o u t i n e f2gp3D ( l o c a t i o n , x d a t a 1 , y d a t a 1 , z d a t a 1 , t i t l e 0 , x l a b e l , y l a b e l , z l a b e l , t i t l e 1 )
915 ! S u b r o u t i n e f2gp3D ( Away , R_Calc , E l e v a t i o n C a l c , ’ D r i l l e d P a t h s ’ , ’ Away [m] ’ , ’ R_{ C a l c u l a t e d } [m
] ’ , ’ E l e v a t i o n [m] ’ )
916 I m p l i c i t None
917
918 Integer :: n1 ! number o f d a t a p o i n t s
919 Real ( 8 ) :: xdata1 (:) ! f i r s t x data array
920 Real ( 8 ) :: ydata1 (:) ! f i r s t y data array
921 Real ( 8 ) :: zdata1 (:)
922 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , zlabel , t i t l e 1 , t i t l e 0 ! p l o t a x i s l a b e l s and
title (s)
923 Character (10) :: Location
924 Integer :: i , E n d 1 s t , End2nd , End3rd , E n d 4 t h
925 Character (50) :: graphtitle1 , graphtitle2 , graphtitle3 , graphtitle4
926
927 n1 = s i z e ( x d a t a 1 )
928
929 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
930 ! Write data in f i l e s
931 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
932 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y z d a t a 1 . dat ’)
933 OPEN( 1 1 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y z d a t a 2 . dat ’)
934 OPEN( 1 2 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y z d a t a 3 . dat ’)
935 OPEN( 1 3 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y z d a t a 4 . dat ’)
936 OPEN( 1 4 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y z d a t a 5 . dat ’)
937
938 End4th = 0
939
940 Do i = 2 , n1 −1
941 I f ( x d a t a 1 ( i + 1 ) == 0 ) Then
942 E n d 1 s t = i +1
943 Exit
944 End I f
945
946 W r i t e ( 1 0 , ’ ( F9 . 3 , 2 ( 1 x , F9 . 3 ) ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i ) , z d a t a 1 ( i )
947 End Do
948
949 Do i = E n d 1 s t , n1 −1
950 I f ( x d a t a 1 ( i + 1 ) < x d a t a 1 ( i ) ) Then
951 End2nd = i
952 Exit
953 End I f
954
955 W r i t e ( 1 1 , ’ ( F9 . 3 , 2 ( 1 x , F9 . 3 ) ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i ) , z d a t a 1 ( i )
956 End Do
957
958 Do i = End2nd +1 , n1 −1
959 I f ( x d a t a 1 ( i + 1 ) < x d a t a 1 ( i ) ) Then
960 End3rd = i
961 Exit
962 End I f
963 W r i t e ( 1 2 , ’ ( F9 . 3 , 2 ( 1 x , F9 . 3 ) ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i ) , z d a t a 1 ( i )
964 End Do
965
966 Do i = End3rd +1 , n1 −1
967 I f ( x d a t a 1 ( i + 1 ) < x d a t a 1 ( i ) ) Then
245

968 End4th = i
969 Exit
970 End I f
971 W r i t e ( 1 3 , ’ ( F9 . 3 , 2 ( 1 x , F9 . 3 ) ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i ) , z d a t a 1 ( i )
972 End Do
973
974 I f ( E n d 4 t h > 0 ) Then
975 Do i = E n d 4 t h +1 , n1 −1
976 W r i t e ( 1 4 , ’ ( F9 . 3 , 2 ( 1 x , F9 . 3 ) ) ’ ) x d a t a 1 ( i ) , y d a t a 1 ( i ) , z d a t a 1 ( i )
977 End do
978 End I f
979
980 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
981 CLOSE ( 1 1 , S t a t u s = ’KEEP ’ )
982 CLOSE ( 1 2 , S t a t u s = ’KEEP ’ )
983 CLOSE ( 1 3 , S t a t u s = ’KEEP ’ )
984 CLOSE ( 1 4 , S t a t u s = ’KEEP ’ )
985
986 ! C r e a t e g n u p l o t command f i l e
987 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
988 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
989 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 1 6 0 0 ’
990 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / ’ / / t r i m ( t i t l e 0 ) / / ’ .
png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
991 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e f o n t " , 2 4 " ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e 1 ) / / ’ } " ’
992
993 ! Graph T i t l e , t i t l e i n b o l d , works
994 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l f o n t " , 2 0 " ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’
995 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l f o n t " , 2 0 " ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " ’
996 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t z l a b e l f o n t " , 2 0 " ’ / / ’ " ’ / / Trim ( z l a b e l ) / / ’ " o f f s e t − 1 , − 0.4 ’ !
O f f s e t c h a n g e s t h e p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and
t i c l a b e l s o v e r l a p . F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
997 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t z r a n g e [ − 9 0 : 5 ] ’
998
999 S e l e c t Case ( L o c a t i o n )
1000
1001 Case ( ’ T e x e l ’ )
1002 Write (10 , * ) ’ set yrange [10: −10] r e v e r s e ’
1003 Write (10 , * ) ’ set f o r [ x = 0 : 1 8 0 0 : 2 0 0 ] a r r o w from x , − 10 , − 90 t o x , − 1 0 , 5 n o h e a d l t 0 lw 2 ’
1004 Write (10 , * ) ’ set f o r [ y = − 1 0 : 1 0 : 1 ] a r r o w from 0 , y , − 90 t o 0 , y , 5 n o h e a d l t 0 lw 2 ’
1005 Write (10 , * ) ’ set f o r [ y = − 1 0 : 1 0 : 1 ] a r r o w from 0 , y , − 90 t o 1 8 0 0 , y , − 90 n o h e a d l t 0 lw 2 ’
1006 Write (10 , * ) ’ set y t i c s f o n t " ,14" o f f s e t 0 , −0.5 ’
1007
1008 Case ( ’ Den H e l d e r ’)
1009 Write (10 , * ) ’ set yrange [10: −10] r e v e r s e ’
1010 Write (10 , * ) ’ set f o r [ x = 0 : 2 0 0 0 : 2 0 0 ] a r r o w from x , − 10 , − 90 t o x , − 1 0 , 5 n o h e a d l t 0 lw 2 ’
1011 Write (10 , * ) ’ set f o r [ y = − 1 0 : 1 0 : 1 ] a r r o w from 0 , y , − 90 t o 0 , y , 5 n o h e a d l t 0 lw 2 ’
1012 Write (10 , * ) ’ set f o r [ y = − 1 0 : 1 0 : 1 ] a r r o w from 0 , y , − 90 t o 2 0 0 0 , y , − 90 n o h e a d l t 0 lw 2 ’
1013 Write (10 , * ) ’ set y t i c s f o n t " ,14" o f f s e t 0 , −0.5 ’
1014
1015 End S e l e c t
1016
1017 Write (10 , * ) ’ s e t x t i c s f o n t " ,14" ’
1018 Write (10 , * ) ’ s e t z t i c s f o n t " ,14" ’
1019
1020 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key f o n t " , 2 0 " o p a q u e r i g h t s p a c i n g 2 ’
1021 W r i t e ( 1 0 , * ) ’ s e t g r i d x t i c s z t i c s lw 2 ’
1022 W r i t e ( 1 0 , * ) ’ s e t view 7 0 , 6 0 ’
1023 W r i t e ( 1 0 , * ) ’ s e t x y p l a n e a t −90 ’ ! f o r c e s t h e i n t e r s e c t i o n o f t h e xy p l a n e w i t h
t h e z − a x i s t o be a t −90
1024
1025 Write (10 , * ) ’ s e t s t y l e l i n e 1 l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 3 p t 7 p s 1 ’ ! Red ,
TranspLenSum
1026 Write (10 , * ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 1 ’ ! ( d a r k ) Blue ,
Away
1027 Write (10 , * ) ’ s e t s t y l e l i n e 3 l c r g b ’ ’ # f f a 5 0 0 ’ ’ l t 1 lw 3 p t 7 p s 2 ’ ! Orange ,
TimeIntAvAll
1028 Write (10 , * ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 7 p s 2 ’ ! ( d a r k ) Green
, PumpTime
1029
246 F. Code of the MarsdiepVisual Program

1030 S e l e c t Case ( L o c a t i o n )
1031
1032 Case ( ’ Den H e l d e r ’ )
1033 graphtitle1 = t r i m ( T i t l e 1 ) / / ’ NAP− 85m J e t b i t ’
1034 graphtitle2 = t r i m ( T i t l e 1 ) / / ’ NAP− 85m MudMotor ’
1035 graphtitle3 = t r i m ( T i t l e 1 ) / / ’ NAP− 65m J e t b i t ’
1036
1037 Case ( ’ T e x e l ’ )
1038 graphtitle1 = trim ( Title1 ) // ’ NAP− 65m Jet bit ’
1039 graphtitle2 = trim ( Title1 ) // ’ NAP− 65m MudMotor ’
1040 graphtitle3 = trim ( Title1 ) // ’ NAP− 85m Jet bit ’
1041 graphtitle4 = trim ( Title1 ) // ’ NAP− 85m Mudmotor ’
1042
1043 Case D e f a u l t
1044 W r i t e ( * , ’ (A) ’ ) " L o c a t i o n unknown , no p l o t i s made . "
1045 Read ( * , * )
1046 Return
1047
1048 End S e l e c t
1049
1050 W r i t e ( 1 0 , ’ (A) ’ ) ’ s p l o t " x y z d a t a 1 . d a t " u s i n g 1 : 2 : 3 w i t h l i n e s l s 1 t i t l e " ’ / / t r i m ( g r a p h t i t l e 1 )
/ / ’ " ," xyzdata2 . dat " using 1:2:3 with l i n e s l s 2 t i t l e " ’ / / trim ( g r a p h t i t l e 2 ) / / ’ " ," xyzdata3
. dat " using 1:2:3 with l i n e s l s 3 t i t l e " ’ / / trim ( g r a p h t i t l e 3 ) / / ’ " ," xyzdata4 . dat " using
1:2:3 with l i n e s l s 4 t i t l e " ’ / / trim ( g r a p h t i t l e 4 ) / / ’ " ," xyzdata5 . dat " using 1:2:3 with
lines ls 1 t i t l e " ’ / / trim ( graphtitle3 ) / / ’" ’
1051
1052 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1053
1054 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1055 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1056 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1057
1058 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
1059
1060 Call SYSTEM( ’ del gp . t x t ’ )
1061 Call SYSTEM( ’ del xyzdata1 . dat ’)
1062 Call SYSTEM( ’ del xyzdata2 . dat ’)
1063 Call SYSTEM( ’ del xyzdata3 . dat ’)
1064 Call SYSTEM( ’ del xyzdata4 . dat ’)
1065 Call SYSTEM( ’ del xyzdata5 . dat ’)
1066
1067 ! Check m e s s a g e
1068 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1069 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( t i t l e 0 ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1070
1071 End S u b r o u t i n e
1072
1073 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1074
1075 S u b r o u t i n e f2gpRhData ( Location , xdata , ydata1 , s t y l e 1 , ydata2 , s t y l e 2 , ydata3 , s t y l e 3 , ydata4
, s t y l e 4 , ydata5 , s t y l e 5 , ydata6 , s t y l e 6 , ydata7 , s t y l e 7 , ydata8 , s t y l e 8 , ydata9 , style9 ,
ydata10 , style10 , t i t l e , xlabel , ylabel , g r a p h _ t i t l e 1 , g r a p h _ t i t l e 2 , g r a p h _ t i t l e 3 ,
graph_title4 , graph_title5 , graph_title6 , graph_title7 , graph_title8 , graph_title9 ,
graph_title10 )
1076 ! S u b r o u t i n e f2gpRHData p l o t s t h e r e s u l t s o f t h e v i s c o m e t e r
1077 I m p l i c i t None
1078
1079 Integer : : n1 ! number o f d a t a p o i n t s
1080 Character (*) :: xdata ( : ) ! f i r s t x data array
1081 Integer :: ydata1 ( : ) , ydata2 ( : ) , ydata3 ( : ) , ydata4 ( : ) , ydata5 ( : ) , ydata6 ( : ) , ydata7
( : ) , ydata8 ( : ) , ydata9 ( : ) , ydata10 ( : )
1082 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e ! p l o t a x i s l a b e l s and
title (s)
1083 Character (10) :: Location
1084 Integer :: i
1085 Character (*) :: graph_title1 , graph_title2 , graph_title3 , graph_title4 , graph_title5 ,
graph_title6 , graph_title7 , graph_title8 , graph_title9 , graph_title10
1086 Character (2) :: style1 , style2 , style3 , style4 , style5 , style6 , style7 , style8 , style9 ,
style10
1087 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 ,
247

Layout8 , Layout9 , L a y o u t 1 0
1088
1089 n1 = s i z e ( x d a t a )
1090
1091 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1092 ! Write data in f i l e s
1093 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1094 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1095
1096 Do i = 1 , n1
1097 I f ( y d a t a 1 ( i ) == 0 . o r . y d a t a 2 ( i ) == 0 . o r . y d a t a 3 ( i ) == 0 . o r . y d a t a 4 ( i ) == 0 . o r .
y d a t a 5 ( i ) == 0 . o r . y d a t a 6 ( i ) == 0 . o r . y d a t a 7 ( i ) == 0 . o r . y d a t a 8 ( i ) == 0 ) Then
1098 Write (10 , * )
1099 Else
1100 W r i t e ( 1 0 , ’ (A, 1 x , I , 1 0 ( 1 x , I 3 . 3 ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) ,
ydata5 ( i ) , ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i ) , ydata9 ( i ) , ydata10 ( i )
1101 End I f
1102 End Do
1103
1104 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1105
1106 ! C r e a t e g n u p l o t command f i l e
1107 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1108 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1109 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create
. png
1110 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t ’ / / t r i m ( t i t l e ) / /
’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
1111 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ } " ’ ! Graph T i t l e , t i t l e
i n b o l d , works
1112 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’
1113 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " ’
1114 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key L e f t r i g h t o u t s i d e ’
1115 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x t i c s r o t a t e by −45 ’
1116 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
1117
1118 Call GraphStyle ( Style1 , Layout1 )
1119 Call GraphStyle ( Style2 , Layout2 )
1120 Call GraphStyle ( Style3 , Layout3 )
1121 Call GraphStyle ( Style4 , Layout4 )
1122 Call GraphStyle ( Style5 , Layout5 )
1123 Call GraphStyle ( Style6 , Layout6 )
1124 Call GraphStyle ( Style7 , Layout7 )
1125 Call GraphStyle ( Style8 , Layout8 )
1126 Call GraphStyle ( Style9 , Layout9 )
1127 Call GraphStyle ( Style10 , Layout10 )
1128
1129 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ t i t l e " ’
/ / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 2 / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 3 / / ’ t i t l e
" ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 4 / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 5 / /
’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 6
/ / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / /
L a y o u t 7 / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h
’ / / L a y o u t 8 / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 8 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 1 : x t i c l a b e l s ( 1 )
w i t h ’ / / L a y o u t 9 / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 2 : x t i c l a b e l s
( 1 ) w i t h ’ / / L a y o u t 1 0 / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 0 ) / / ’ " ’
1130
1131 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1132
1133 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1134 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1135 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1136
1137 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
1138
1139 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1140 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
248 F. Code of the MarsdiepVisual Program

1141
1142 ! Check m e s s a g e
1143 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1144 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / t r i m ( T i t l e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1145
1146 End S u b r o u t i n e
1147
1148 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1149
1150 Subroutine f2gpSamplePar ( Location , xdata , ydata1 , s t y l e 1 , ydata2 , s t y l e 2 , t i t l e , xlabel , ylabel1 ,
ylabel2 , graph_title1 , g r a p h _ t i t l e 2 )
1151 ! P l o t s two s a m p l e p a r a m e t e r s i n one g r a p h w i t h d i f f e r e n t y − a x i s .
1152 I m p l i c i t None
1153
1154 Character (10) :: Location
1155 Character (*) :: xdata ( : )
1156 Real :: ydata1 ( : ) , ydata2 ( : )
1157 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel1 , ylabel2 , t i t l e
1158 Character (*) :: graph_title1 , graph_title2
1159 Character (2) :: style1 , style2
1160 Character (25) :: Layout1 , L a y o u t 2
1161 Integer :: i , n1
1162
1163 n1 = size ( xdata )
1164
1165 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1166 ! Write data in f i l e s
1167 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1168 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1169
1170 Do i = 1 , n1
1171 I f ( y d a t a 1 ( i ) == 0 . o r . y d a t a 2 ( i ) == 0 ) Then
1172 Write (10 , * )
1173 Else
1174 W r i t e ( 1 0 , ’ (A, 1 x , I , 1 x , F6 . 3 , 1 x , F6 . 2 ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i )
1175 End I f
1176 End Do
1177
1178 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1179
1180 ! C r e a t e g n u p l o t command f i l e
1181 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1182 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1183 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create
. png
1184 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t ’ / / t r i m ( t i t l e ) / /
’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
1185 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ } " ’ ! Graph T i t l e ,
t i t l e i n b o l d , works
1186 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’
1187 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 1 ) / / ’ " ’
1188 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / TRIM ( y l a b e l 2 ) / / ’ " ’
1189 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key L e f t r i g h t o u t s i d e ’
1190 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x t i c s r o t a t e by −45 ’
1191 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
1192
1193 S e l e c t Case ( t i t l e ) ! F i x e s t h e a x i s s o t h a t t h e g r i d i s c o r r e c t on b o t h a x i s , t h i s o f
c o u r s e c a n o n l y be done f o r known c a s e s .
1194
1195 Case ( ’DH D e n s i t y vs . Sand C o n t e n t ’ )
1196 Write (10 , * ) ’ set ytics 0 ,0.3 ,1.5 ’
1197 Write (10 , * ) ’ set y2tics 0 ,0.05 ,0.25 ’
1198 Write (10 , * ) ’ set yrange [ 0 : 1 . 5 ] ’
1199 Write (10 , * ) ’ set y2range [ 0 : 0 . 2 5 ] ’
1200
1201 Case ( ’T D e n s i t y v s . Sand C o n t e n t ’ )
1202 Write (10 , * ) ’ set ytics 0 ,0.3 ,1.5 ’
1203 Write (10 , * ) ’ set y2tics 0 ,0.02 ,0.1 ’
1204 Write (10 , * ) ’ s e t yrange [ 0 : 1 . 5 ] ’
1205 Write (10 , * ) ’ s e t y2range [ 0 : 0 . 1 ] ’
249

1206
1207 Case ( ’DH T e m p e r a t u r e v s . Marsh F u n n e l ’ )
1208 Write (10 , * ) ’ s e t ytics 0 ,5 ,25 ’
1209 Write (10 , * ) ’ s e t y 2 t i c s 0 ,40 ,200 ’
1210 Write (10 , * ) ’ s e t yrange [ 0 : 2 5 ] ’
1211 Write (10 , * ) ’ s e t y2range [0:200] ’
1212
1213 Case ( ’T T e m p e r a t u r e v s . Marsh F u n n e l ’ )
1214 Write (10 , * ) ’ s e t y t i c s 0 ,5 ,30 ’
1215 Write (10 , * ) ’ s e t y 2 t i c s 0 ,20 ,120 ’
1216 Write (10 , * ) ’ s e t yrange [ 0 : 3 0 ] ’
1217 Write (10 , * ) ’ s e t y2range [ 0 : 1 2 0 ] ’
1218
1219 Case D e f a u l t
1220 Write (10 , * ) ’ s e t y t i c s ’
1221 Write (10 , * ) ’ s e t y 2 t i c s ’
1222 Write (10 , * ) ’ s e t yrange [ 0 : * ] ’ ! F o r c e s t h e minimum o f t h e y − a x i s t o be 0
while the upperlimit i s s t i l l f l e x i b l e .
1223 Write (10 , * ) ’ s e t y2range [ 0 : * ] ’
1224 W r i t e ( * , ’ (A) ’ ) ’ Graph i s n o t s p e c i f i e d , t h e t i c s on t h e a x e s and i t s v a l u e s c a n l o o k
weird but are c o r r e c t . ’
1225 End S e l e c t
1226
1227 C a l l GraphStyle ( Style1 , Layout1 )
1228 C a l l GraphStyle ( Style2 , Layout2 )
1229
1230 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ a x e s
x1y1 t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ a x e s x1y2 t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " ’
1231
1232 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1233
1234 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1235 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1236 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1237
1238 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
1239
1240 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1241 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
1242
1243 ! Check m e s s a g e
1244 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1245 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1246
1247 End S u b r o u t i n e
1248
1249 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1250
1251 S u b r o u t i n e f2gpwBG ( wdata1 , x d a t a 1 , y d a t a 1 , S t y l e 1 , wdata2 , x d a t a 2 , y d a t a 2 , S t y l e 2 , t i t l e , x l a b e l ,
ylabel , graphtitle1 , g r a p h t i t l e 2 )
1252 ! I m p l e m e n t a p i c t u r e f o r t h e b a c k g r o u n d . Based on a m o n g s t o t h e r s ; h t t p : / / www. g n u p l o t t i n g .
o r g / t a g / image / .
1253 ! And p l o t s r e s u l t s o f t h e Sample S o u r c e p r o g r a m on t o p o f i t .
1254 I m p l i c i t None
1255
1256 Character (*) :: wdata1 ( : ) , wdata2 ( : )
1257 Real :: xdata1 ( : ) , ydata1 ( : ) , xdata2 ( : ) , ydata2 ( : )
1258 Character (2) :: Style1 , Style2
1259 Character (25) :: Layout1 , L a y o u t 2
1260 Integer :: i , n1 , n2
1261 Character (50) :: title
1262 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , graphtitle1 , g r a p h t i t l e 2
1263
1264 n1 = size ( xdata1 )
1265 n2 = size ( xdata2 )
1266
1267 write ( * ,* ) xdata1
1268
1269 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
250 F. Code of the MarsdiepVisual Program

1270 ! Write data in f i l e s


1271 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1272 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1273
1274 Do i = 1 , n1
1275 W r i t e ( 1 0 , ’ (A, 2 ( 1 x , F7 . 2 ) ) ’ ) w d a t a 1 ( i ) ,100+ x d a t a 1 ( i ) , y d a t a 1 ( i ) ! The 100 i s b e c a u s e t h e
i n p u t d a t a i n t h i s c a s e i s r e l a t i v e t o t h e o r i g i n , t h e o r i g i n i s a t a p p r o x . 100m.
1276 End Do
1277
1278 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1279
1280 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1281 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ )
1282
1283 Do i = 1 , n2
1284 W r i t e ( 1 0 , ’ (A, 2 ( 1 x , F7 . 2 ) ) ’ ) w d a t a 2 ( i ) ,4675 − x d a t a 2 ( i ) , y d a t a 2 ( i ) ! The 4675 i s b c a u s e
t h e i n p u t d a t a i n t h i s c a s e i s r e l a t i v e t o t h e o r i g i n , t h e o r i g i n i s a t a p p r o x . 4675m.
1285 End Do
1286
1287 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1288
1289 ! C r e a t e g n u p l o t command f i l e
1290 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1291 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1292 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 4 8 0 0 , 2 4 0 0 ’ ! linewidth 2.0 font " ,40"
s i z e 2000 ,1000 ’
1293 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( t i t l e ) / /
’ . png ’ / / ’ " ’
1294 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e " ’ / / t r i m ( t i t l e ) / / ’ " f o n t " , 3 2 " ’
1295
1296 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s i z e 0 . 9 ’
1297 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o r i g i n 0 . 0 5 , 0 . 0 5 ’
1298
1299 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ − 650 : 6110 ] ’ ! Found m a n u a l l y b a s e d on
the picture used , s i n c e i t a l r e a d y c o n t a i n s a s c a l e . . .
1300 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x t i c s 0 , 5 0 0 , 5 0 0 0 o u t n o m i r r o r r o t a t e by −45 ’ ! the values are
OVERWRITTEN due t o u s e o f s a m p l e names on x − a x i s , t h e o t h e r o p t i o n s s t i l l work .
1301 Write (10 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 8 " ’
1302
1303 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ − 153.5 : 32 ] ’ ! Idem d i t o . . .
1304 W r i t e ( 1 0 , ’ (A) ’ ) ’ u n s e t y t i c s ’
1305
1306 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,0 ’
1307
1308 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d f r o n t lw 3 ’
1309
1310 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key a t 5950 , − 140 L e f t r e v e r s e f o n t " , 2 4 " ’
1311
1312 Write (10 , ’ (A) ’) ’ s e t x2range [ 0 : * ] ’ ! noreverse nowriteback ’
1313 Write (10 , ’ (A) ’) ’ s e t y2range [ 0 : * ] ’ ! noreverse nowriteback ’
1314 Write (10 , ’ (A) ’) ’ unset x2tics ’
1315 Write (10 , ’ (A) ’) ’ unset y2tics ’
1316
1317 C a l l GraphStyle ( Style1 , Layout1 )
1318 C a l l GraphStyle ( Style2 , Layout2 )
1319
1320 W r i t e ( 1 0 , ’ (A) ’ ) ’ set lmargin at screen 0.05 ’
1321 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t rmargin at screen 0.85 ’
1322 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t bmargin a t screen 0.05 ’
1323 W r i t e ( 1 0 , ’ (A) ’ ) ’ set tmargin at screen 0.95 ’
1324
1325 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " C r o s s s e c t i o n . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 ) w i t h r g b a l p h a
n o t i t l e a x e s x2y2 , " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ a x e s
x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 1 ) / / ’ " , " x y d a t a 2 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 2 ) / / ’ " ’
1326 ! The v a l u e b e t w e e n b r a c k e t s i n t h e 1 : 2 : 3 : ( X) p a r t n e e d s t o be b e t w e e n 0 ( f u l l y t r a n s p a r a n t
) and 255 ( f u l l y o p a q u e ) .
1327
1328 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1329
1330 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
251

1331 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1332 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1333
1334 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d .
1335
1336 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1337 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
1338 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
1339
1340 ! Check m e s s a g e
1341 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1342 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / t r i m ( t i t l e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1343
1344 End S u b r o u t i n e
1345
1346 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1347
1348 S u b r o u t i n e f2gpwBG2 ( G r a p h O p t i o n , f i l e n a m e , wdata1 , x d a t a 1 , y d a t a 1 , S t y l e 1 , x d a t a 3 , y d a t a 3 , s t y l e 3 ,
wdata2 , x d a t a 2 , y d a t a 2 , S t y l e 2 , x d a t a 4 , y d a t a 4 , s t y l e 4 , t i t l e , x l a b e l , y l a b e l , g r a p h t i t l e 1 ,
graphtitle2 , graphtitle3 , graphtitle4 )
1349 ! I m p l e m e n t a p i c t u r e f o r t h e b a c k g r o u n d . Based on a m o n g s t o t h e r s ; h t t p : / / www. g n u p l o t t i n g .
o r g / t a g / image / .
1350 ! And p l o t s r e s u l t s o f t h e Sample S o u r c e p r o g r a m on t o p o f i t .
1351 I m p l i c i t None
1352
1353 Character (*) :: wdata1 ( : ) , wdata2 ( : )
1354 Real :: xdata1 ( : ) , ydata1 ( : ) , xdata2 ( : ) , ydata2 ( : )
1355 Real ( 8 ) :: xdata3 ( : ) , ydata3 ( : ) , xdata4 ( : ) , ydata4 ( : )
1356 Character (2) :: Style1 , Style2
1357 Character (2) :: Style3 , Style4
1358 Character (25) :: Layout1 , L a y o u t 2
1359 Character (25) :: Layout3 , L a y o u t 4
1360 Integer :: i , n1 , n2 , n3 , n4
1361 Character (50) :: title
1362 Character (50) :: filename
1363 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , graphtitle1 , graphtitle2 , graphtitle3 , g r a p h t i t l e 4
1364 Integer :: GraphOption
1365
1366 n1 = size ( xdata1 )
1367 n2 = size ( xdata2 )
1368 n3 = size ( xdata3 )
1369 n4 = size ( xdata4 )
1370
1371 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1372 ! Write data in f i l e s
1373 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1374 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1375
1376 Do i = 1 , n1
1377 W r i t e ( 1 0 , ’ (A, 1 x , F7 . 2 , 1 x , F7 . 2 ) ’ ) w d a t a 1 ( i ) ,100+ x d a t a 1 ( i ) , y d a t a 1 ( i ) ! The 100 i s
because the i n p u t d a t a in t h i s case i s r e l a t i v e to the origin , the o r i g i n i s a t approx .
100m.
1378 End Do
1379
1380 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1381
1382 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1383 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ )
1384
1385 Do i = 1 , n2
1386 W r i t e ( 1 0 , ’ (A, 1 x , F7 . 2 , 1 x , F7 . 2 ) ’ ) w d a t a 2 ( i ) ,4675 − x d a t a 2 ( i ) , y d a t a 2 ( i ) ! The 4675 i s
because the i n p u t data in t h i s case i s r e l a t i v e to the origin , the o r i g i n i s a t approx .
4675m.
1387 End Do
1388
1389 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1390
1391 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1392 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 3 . d a t ’ )
1393
1394 W r i t e ( 1 0 , ’ ( F7 . 2 , 1 x , F7 . 2 ) ’ ) 100+ x d a t a 3 ( 1 ) , y d a t a 3 ( 1 )
252 F. Code of the MarsdiepVisual Program

1395
1396 Do i = 2 , n3
1397 I f ( x d a t a 3 ( i ) < x d a t a 3 ( i − 1) ) W r i t e ( 1 0 , * )
1398 W r i t e ( 1 0 , ’ ( F7 . 2 , 1 x , F7 . 2 ) ’ ) 100+ x d a t a 3 ( i ) , y d a t a 3 ( i ) ! The 100 i s b e c a u s e t h e i n p u t
d a t a i n t h i s c a s e i s r e l a t i v e t o t h e o r i g i n , t h e o r i g i n i s a t a p p r o x . 100m.
1399 End Do
1400
1401 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1402
1403 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1404 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 4 . d a t ’ )
1405
1406 Do i = 1 , n4
1407 I f ( x d a t a 4 ( i ) < x d a t a 4 ( i − 1) ) W r i t e ( 1 0 , * )
1408 W r i t e ( 1 0 , ’ ( F7 . 2 , 1 x , F7 . 2 ) ’ ) 4675 − x d a t a 4 ( i ) , y d a t a 4 ( i ) ! The 4675 i s b e c a u s e t h e
i n p u t d a t a i n t h i s c a s e i s r e l a t i v e t o t h e o r i g i n , t h e o r i g i n i s a t a p p r o x . 4675m.
1409 End Do
1410
1411 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1412
1413 ! C r e a t e g n u p l o t command f i l e
1414 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1415 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1416 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 4 8 0 0 , 2 4 0 0 ’ ! linewidth 2.0 font " ,40"
s i z e 2000 ,1000 ’
1417 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( f i l e n a m e
) / / ’ . png ’ / / ’ " ’
1418 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e " ’ / / t r i m ( t i t l e ) / / ’ " f o n t " , 3 2 " ’
1419
1420 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s i z e 0 . 9 ’
1421 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o r i g i n 0 . 0 5 , 0 . 0 5 ’
1422 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ − 650 : 6110 ] ’ ! Found m a n u a l l y b a s e d on
t h e p i c t u r e used , s i n c e i t a l r e a d y c o n t a i n s a s c a l e . . .
1423 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 8 " ’
1424 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x t i c s 0 , 5 0 0 , 5 0 0 0 o u t n o m i r r o r r o t a t e by −45 ’ ! the values are
OVERWRITTEN due t o u s e o f s a m p l e names on x − a x i s , t h e o t h e r o p t i o n s s t i l l work .
1425 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ − 153.5 : 32 ] ’ ! Idem d i t o . . .
1426 W r i t e ( 1 0 , ’ (A) ’ ) ’ u n s e t y t i c s ’
1427 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y t i c s − 150 ,50 ,50 o u t n o m i r r o r f o n t " , 2 2 " ’ ! R e p l a c e s by a r r o w s s i n c e
t h e h o r i z o n t a l g r i d l i n e s went i n t o t h e key a t t h e s i d e .
1428
1429 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,0 ’
1430
1431 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d f r o n t lw 3 ’
1432 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key a t 6100 , − 135 L e f t r e v e r s e f o n t " , 2 4 " ’
1433
1434 Write (10 , ’ (A) ’) ’ s e t x2range [ 0 : * ] ’ ! noreverse nowriteback ’
1435 Write (10 , ’ (A) ’) ’ s e t y2range [ 0 : * ] ’ ! noreverse nowriteback ’
1436 Write (10 , ’ (A) ’) ’ unset x2tics ’
1437 Write (10 , ’ (A) ’) ’ unset y2tics ’
1438
1439 Call GraphStyle ( Style1 , Layout1 )
1440 Call GraphStyle ( Style2 , Layout2 )
1441 Call GraphStyle ( Style3 , Layout3 )
1442 Call GraphStyle ( Style4 , Layout4 )
1443
1444 W r i t e ( 1 0 , ’ (A) ’ ) ’ set lmargin at screen 0.05 ’
1445 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t rmargin at screen 0.85 ’
1446 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t bmargin a t screen 0.05 ’
1447 W r i t e ( 1 0 , ’ (A) ’ ) ’ set tmargin at screen 0.95 ’
1448
1449 S e l e c t Case ( G r a p h O p t i o n )
1450
1451 Case ( 1 ) ! Head L o c a t i o n s a m p l i n g t i m e
1452 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " C r o s s s e c t i o n . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 ) w i t h
r g b a l p h a n o t i t l e a x e s x2y2 , " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / /
’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 1 ) / / ’ " , " x y d a t a 2 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’
/ / t r i m ( L a y o u t 2 ) / / ’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 2 ) / / ’ " ’
1453 ! The v a l u e b e t w e e n b r a c k e t s i n t h e 1 : 2 : 3 : ( X) p a r t n e e d s t o be b e t w e e n 0 ( f u l l y
t r a n s p a r a n t ) and 255 ( f u l l y o p a q u e ) .
1454
253

1455 Case ( 3 ) ! Drilled Paths


1456 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " C r o s s s e c t i o n . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 ) w i t h
r g b a l p h a n o t i t l e a x e s x2y2 , " x y d a t a 3 . d a t " u s i n g 1 : 2 w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ a x e s x1y1
t i t l e " ’ / / TRIM ( g r a p h t i t l e 3 ) / / ’ " , " x y d a t a 4 . d a t " u s i n g 1 : 2 w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ a x e s
x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 4 ) / / ’ " ’
1457
1458 Case ( 4 ) ! D r i l l e d P a t h s and Head L o c a t i o n a t S a m p l i n g Time
1459 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " C r o s s s e c t i o n . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 ) w i t h
r g b a l p h a n o t i t l e a x e s x2y2 , " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / /
’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 1 ) / / ’ " , " x y d a t a 2 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’
/ / t r i m ( L a y o u t 2 ) / / ’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 2 ) / / ’ " , " x y d a t a 3 . d a t " u s i n g 1 : 2 w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 3 ) / / ’ " , " x y d a t a 4 . d a t " u s i n g 1 : 2
w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ a x e s x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 4 ) / / ’ " ’
1460
1461 ! Case ( 5 ) ! D r i l l e d p a t h s and s o u r c e l o c a t i o n
1462 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " C r o s s s e c t i o n . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 ) w i t h
r g b a l p h a n o t i t l e a x e s x2y2 , " x y d a t a 3 . d a t " u s i n g 1 : 2 w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ a x e s x1y1
t i t l e " ’ / / TRIM ( g r a p h t i t l e 3 ) / / ’ " , " x y d a t a 4 . d a t " u s i n g 1 : 2 w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ a x e s
x1y1 t i t l e " ’ / / TRIM ( g r a p h t i t l e 4 ) / / ’ " ’
1463
1464 End S e l e c t
1465
1466 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1467
1468 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1469 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1470 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1471
1472 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d .
1473
1474 Call SYSTEM( ’ del gp . t x t ’ )
1475 Call SYSTEM( ’ del xydata1 . dat ’)
1476 Call SYSTEM( ’ del xydata2 . dat ’)
1477 Call SYSTEM( ’ del xydata3 . dat ’)
1478 Call SYSTEM( ’ del xydata4 . dat ’)
1479
1480 ! Check m e s s a g e
1481 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1482 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " P l o t _ ’ / / t r i m ( f i l e n a m e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1483
1484 End S u b r o u t i n e
1485
1486 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1487
1488 S u b r o u t i n e f 2 g p S i e v e ( t i t l e , x l a b e l , y l a b e l , I n d e x 1 , S t y l e 1 , Sample_Code , D, I n d e x 2 , S t y l e 2 , I n d e x 3 ,
Style3 , Index4 , Style4 , Index5 , Style5 , Index6 , Style6 , Index7 , Style7 , Index8 , Style8 , Index9 ,
s t y l e 9 , Index10 , Style10 , Index11 , Style11 , Index12 , Style12 , Index13 , s t y l e 1 3 , Index14 , Style14 ,
Index15 , Style15 , Index16 , S t y l e 1 6 )
1489 ! P l o t s d i f f e r e n t s a n d c u r v e s , up t o 5 i n t h e same g r a p h .
1490 I m p l i c i t None
1491
1492 Character (*) :: title
1493 Character (*) :: xlabel , ylabel
1494 Character (14) : : Sample_Code ( : )
1495 Integer :: Index1
1496 Integer , Optional :: Index2 , Index3 , Index4 , Index5 , Index6 , Index7 , Index8 , Index9 ,
Index10 , Index11 , Index12 , Index13 , Index14 , Index15 , Index16
1497 ! O p t i o n a l o n l y works f o r u n i t s t h a t a r e c a l l e d o r e x p o r t e d , i n t e r n a l u n i t s a r e d e f i n e d i n
any c a s e . i . e . l a y o u t i s i n t e r n a l and t h u s l a c k s t h e o p t i o n a l a r g u m e n t .
1498
1499 Character (2) :: Style1
1500 Character (2) , Optional :: Style2 , Style3 , Style4 , Style5 , Style6 , Style7 , Style8 , Style9 ,
Style10 , Style11 , Style12 , Style13 , Style14 , Style15 , Style16
1501 Character (25) :: Layout1
1502 Character (25) :: Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 , Layout8 ,
Layout9 , Layout10 , Layout11 , Layout12 , Layout13 , Layout14 , Layout15 , L a y o u t 1 6
1503 Real : : D( : , : )
1504 Integer :: i, j
1505
1506 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1507 ! Write data in f i l e s
254 F. Code of the MarsdiepVisual Program

1508 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1509 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1510
1511 I f ( ( s i z e (D) / 9 9 ) == 6 9 ) W r i t e ( 1 0 , ’ (A, 6 9 ( 1 x , A) ) ’ ) ’ Y d a t a ’ , Sample_Code ( : )
1512 I f ( ( s i z e (D) / 9 9 ) == 4 3 ) W r i t e ( 1 0 , ’ (A, 4 3 ( 1 x , A) ) ’ ) ’ Y d a t a ’ , Sample_Code ( : )
1513
1514 Do j = 1 , 99
1515 Write (10 , ’ ( I ,1 x , 9 8 ( F ,1 x ) ,F) ’ ) j , D( : , j )
1516 End Do
1517
1518 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1519
1520 ! C r e a t e g n u p l o t command f i l e
1521 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1522 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1523 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 2 4 0 0 , 2 4 0 0 ’ ! l i n e w i d t h 2 . 0 f o n t " , 4 0 " s i z e
2000 ,1000 ’
1524 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / S i e v e C u r v e s / ’ / / t r i m (
t i t l e ) / / ’ . png ’ / / ’ " ’
1525 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e " ’ / / t r i m ( t i t l e ) / / ’ " f o n t " , 3 2 " ’
1526
1527 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ 0 . 0 0 1 : 10 ] ’ ! Found m a n u a l l y b a s e d on t h e p i c t u r e
used , s i n c e i t already contains a scale . . .
1528 W r i t e ( 1 0 , ’ (A) ’ ) ’ set xtics ’
1529 W r i t e ( 1 0 , ’ (A) ’ ) ’ set mxtics ’
1530 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 8 " ’
1531
1532 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : 100 ] ’ ! Idem d i t o . . .
1533 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y t i c s 0 , 1 0 , 1 0 0 ’
1534 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,0 ’
1535
1536 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d x t i c s m x t i c s y t i c s l c r g b " b l a c k " l t 1 lw 1 ’
1537
1538 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key L e f t r e v e r s e f o n t " , 2 4 " ’
1539
1540 Write (10 , ’ (A) ’) ’ set tmargin at screen 0.95 ’
1541 Write (10 , ’ (A) ’) ’ set bmargin at screen 0.05 ’
1542 Write (10 , ’ (A) ’) ’ set rmargin at screen 0.95 ’
1543 Write (10 , ’ (A) ’) ’ set lmargin at screen 0.05 ’
1544
1545 C a l l G r a p h S t y l e ( S t y l e 1 , Layout1 , I n d e x 1 )
1546 I f ( P r e s e n t ( I n d e x 2 ) ) C a l l G r a p h S t y l e ( S t y l e 2 , Layout2 , I n d e x 2 )
1547 I f ( P r e s e n t ( I n d e x 3 ) ) C a l l G r a p h S t y l e ( S t y l e 3 , Layout3 , I n d e x 3 )
1548 I f ( P r e s e n t ( I n d e x 4 ) ) C a l l G r a p h S t y l e ( S t y l e 4 , Layout4 , I n d e x 4 )
1549 I f ( P r e s e n t ( I n d e x 5 ) ) C a l l G r a p h S t y l e ( S t y l e 5 , Layout5 , I n d e x 5 )
1550 I f ( P r e s e n t ( I n d e x 6 ) ) C a l l G r a p h S t y l e ( S t y l e 6 , Layout6 , I n d e x 6 )
1551 I f ( P r e s e n t ( I n d e x 7 ) ) C a l l G r a p h S t y l e ( S t y l e 7 , Layout7 , I n d e x 7 )
1552 I f ( P r e s e n t ( I n d e x 8 ) ) C a l l G r a p h S t y l e ( S t y l e 8 , Layout8 , I n d e x 8 )
1553 I f ( P r e s e n t ( I n d e x 9 ) ) C a l l G r a p h S t y l e ( S t y l e 9 , Layout9 , I n d e x 9 )
1554 I f ( P r e s e n t ( I n d e x 1 0 ) ) C a l l G r a p h S t y l e ( S t y l e 1 0 , Layout10 , I n d e x 1 0 )
1555 I f ( P r e s e n t ( I n d e x 1 1 ) ) C a l l G r a p h S t y l e ( S t y l e 1 1 , Layout11 , I n d e x 1 1 )
1556 I f ( P r e s e n t ( I n d e x 1 2 ) ) C a l l G r a p h S t y l e ( S t y l e 1 2 , Layout12 , I n d e x 1 2 )
1557 I f ( P r e s e n t ( I n d e x 1 3 ) ) C a l l G r a p h S t y l e ( S t y l e 1 3 , Layout13 , I n d e x 1 3 )
1558 I f ( P r e s e n t ( I n d e x 1 4 ) ) C a l l G r a p h S t y l e ( S t y l e 1 4 , Layout14 , I n d e x 1 4 )
1559 I f ( P r e s e n t ( I n d e x 1 5 ) ) C a l l G r a p h S t y l e ( S t y l e 1 5 , Layout15 , I n d e x 1 5 )
1560 I f ( P r e s e n t ( I n d e x 1 6 ) ) C a l l G r a p h S t y l e ( S t y l e 1 6 , Layout16 , I n d e x 1 6 )
1561
1562 Write (10 , * ) ’ s e t log x ’
1563
1564 I f ( P r e s e n t ( I n d e x 1 6 ) ) Then
1565 W r i t e ( 1 0 , ’ (A, 1 6 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ ’ , Index12 , ’
’ , I n d e x 1 3 , ’ ’ , I n d e x 1 4 , ’ ’ , I n d e x 1 5 , ’ ’ , I n d e x 1 6 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1
with l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1566 E l s e I f ( P r e s e n t ( I n d e x 1 5 ) ) Then
1567 W r i t e ( 1 0 , ’ (A, 1 5 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ ’ , Index12 , ’
’ , I n d e x 1 3 , ’ ’ , I n d e x 1 4 , ’ ’ , I n d e x 1 5 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s (
n ) t i t l e columnheader ( n +1) ’
1568 E l s e I f ( P r e s e n t ( I n d e x 1 4 ) ) Then
1569 W r i t e ( 1 0 , ’ (A, 1 4 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
255

Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ ’ , Index12 , ’


’ , I n d e x 1 3 , ’ ’ , I n d e x 1 4 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e
columnheader ( n +1) ’
1570 E l s e I f ( P r e s e n t ( I n d e x 1 3 ) ) Then
1571 W r i t e ( 1 0 , ’ (A, 1 3 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ ’ , Index12 , ’
’ , I n d e x 1 3 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n
+1) ’
1572 E l s e I f ( P r e s e n t ( I n d e x 1 2 ) ) Then
1573 W r i t e ( 1 0 , ’ (A, 1 2 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ ’ , Index12 , ’
" ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1574 E l s e I f ( P r e s e n t ( I n d e x 1 1 ) ) Then
1575 W r i t e ( 1 0 , ’ (A, 1 1 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ ’ , Index11 , ’ " ] " xydata1 .
d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1576 E l s e I f ( P r e s e n t ( I n d e x 1 0 ) ) Then
1577 W r i t e ( 1 0 , ’ (A, 1 0 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
Index5 , ’ ’ , Index6 , ’ ’ , Index7 , ’ ’ , Index8 , ’ ’ , Index9 , ’ ’ , Index10 , ’ " ] " xydata1 . d a t " u s i n g (
column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1578 E l s e I f ( P r e s e n t ( I n d e x 9 ) ) Then
1579 W r i t e ( 1 0 , ’ (A, 9 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ ’ , I n d e x 8 , ’ ’ , I n d e x 9 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) )
: 1 with l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1580 E l s e I f ( P r e s e n t ( I n d e x 8 ) ) Then
1581 W r i t e ( 1 0 , ’ (A, 8 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ ’ , I n d e x 8 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h
l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1582 E l s e I f ( P r e s e n t ( I n d e x 7 ) ) Then
1583 W r i t e ( 1 0 , ’ (A, 7 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n )
t i t l e columnheader ( n +1) ’
1584 E l s e I f ( P r e s e n t ( I n d e x 6 ) ) Then
1585 W r i t e ( 1 0 , ’ (A, 6 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e
columnheader ( n +1) ’
1586 E l s e I f ( P r e s e n t ( I n d e x 5 ) ) Then
1587 W r i t e ( 1 0 , ’ (A, 5 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1588 E l s e I f ( P r e s e n t ( I n d e x 4 ) ) Then
1589 W r i t e ( 1 0 , ’ (A, 4 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ " ] "
x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1590 E l s e I f ( P r e s e n t ( I n d e x 3 ) ) Then
1591 W r i t e ( 1 0 , ’ (A, 3 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ " ] " x y d a t a 1 . d a t "
u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1592 E l s e I f ( P r e s e n t ( I n d e x 2 ) ) Then
1593 W r i t e ( 1 0 , ’ (A, 2 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ " ] " x y d a t a 1 . d a t " u s i n g (
column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1594 Else
1595 W r i t e ( 1 0 , ’ (A, 1 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1
with l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1596 End I f
1597
1598 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1599
1600 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1601 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1602 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1603
1604 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d .
1605
1606 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1607 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
1608
1609 ! Check m e s s a g e
1610 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1611 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / t r i m ( t i t l e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1612
1613 End S u b r o u t i n e
1614
1615 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
256 F. Code of the MarsdiepVisual Program

1616
1617 S u b r o u t i n e f 2 g p S i e v e 2 ( t i t l e , x l a b e l , y l a b e l , Sample_Code , D, Sample_Code_V , D_V , I n d e x 1 , s t y l e 1 ,
Index2 , s t y l e 2 , Index3 , s t y l e 3 , Index4 , s t y l e 4 , Index5 , s t y l e 5 , Index6 , s t y l e 6 , Index7 , s t y l e 7 ,
Index8 , s t y l e 8 , Index9 , s t y l e 9 )
1618 ! P l o t s d i f f e r e n t s a n d c u r v e s , up t o 5 i n t h e same g r a p h .
1619 I m p l i c i t None
1620
1621 Character (*) :: title
1622 Character (*) :: xlabel , ylabel
1623 Character (14) : : Sample_Code ( : ) , Sample_Code_V ( : )
1624 Integer :: Index1 , Index2
1625 Integer , Optional :: Index3 , Index4 , Index5 , Index6 , Index7 , Index8 , Index9 !
O p t i o n a l o n l y works f o r u n i t s t h a t a r e c a l l e d o r e x p o r t e d , i n t e r n a l u n i t s a r e d e f i n e d i n
any c a s e . i . e . l a y o u t i s i n t e r n a l and t h u s l a c k s t h e o p t i o n a l a r g u m e n t .
1626 Character (2) :: Style1 , Style2
1627 Character (2) , Optional :: Style3 , Style4 , Style5 , Style6 , Style7 , Style8 , Style9
1628 Character (25) :: Layout1
1629 Character (25) :: Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 , Layout8 ,
Layout9
1630 Real : : D( : , : )
1631 Real : : D_V ( : , : )
1632 Integer :: i, j
1633
1634 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1635 ! Write data in f i l e s
1636 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1637 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1638
1639 I f ( ( s i z e (D) / 9 9 ) == 6 9 ) W r i t e ( 1 0 , ’ (A, 6 9 ( 1 x , A) ) ’ ) ’ Y d a t a ’ , Sample_Code ( : )
1640
1641 Do j = 1 , 99
1642 Write (10 , ’ ( I ,1 x , 9 8 ( F ,1 x ) ,F) ’ ) j , D( : , j )
1643 End Do
1644
1645 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1646
1647 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1648
1649 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 2 . d a t ’ )
1650
1651 W r i t e ( 1 0 , ’ (A, 4 3 ( 1 x , A) ) ’ ) ’ Y d a t a ’ , Sample_Code_V ( : )
1652
1653 Do j = 1 , 99
1654 W r i t e ( 1 0 , ’ ( I , 1 x , 9 8 ( F , 1 x ) , F ) ’ ) j , D_V ( : , j )
1655 End Do
1656
1657 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1658
1659 ! C r e a t e g n u p l o t command f i l e
1660 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1661 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1662 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 2 4 0 0 , 2 4 0 0 ’ ! l i n e w i d t h 2 . 0 f o n t " , 4 0 " s i z e
2000 ,1000 ’
1663 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / S i e v e C u r v e s / P l o t ’ / /
t r i m ( t i t l e ) / / ’ . png ’ / / ’ " ’
1664 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e " ’ / / t r i m ( t i t l e ) / / ’ " f o n t " , 3 2 " ’
1665
1666 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ 0 . 0 0 1 : 10 ] ’ ! Found m a n u a l l y b a s e d on t h e p i c t u r e
used , s i n c e i t already contains a scale . . .
1667 W r i t e ( 1 0 , ’ (A) ’ ) ’ set xtics ’
1668 W r i t e ( 1 0 , ’ (A) ’ ) ’ set mxtics ’
1669 Write (10 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 8 " ’
1670
1671 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : 100 ] ’ ! Idem d i t o . . .
1672 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y t i c s 0 , 1 0 , 1 0 0 ’
1673
1674 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,0 ’
1675
1676 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d x t i c s m x t i c s y t i c s l c r g b " b l a c k " l t 1 lw 1 ’
1677 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key L e f t r e v e r s e f o n t " , 2 4 " ’
1678
257

1679 Write (10 , * ) ’ set tmargin at screen 0.95 ’


1680 Write (10 , * ) ’ set bmargin at screen 0.05 ’
1681 Write (10 , * ) ’ set rmargin at screen 0.95 ’
1682 Write (10 , * ) ’ set lmargin at screen 0.05 ’
1683
1684 C a l l G r a p h S t y l e ( S t y l e 1 , Layout1 , I n d e x 1 )
1685 C a l l G r a p h S t y l e ( S t y l e 2 , Layout2 , I n d e x 2 )
1686
1687 If ( P r e s e n t ( Index3 ) ) Call GraphStyle ( Style3 , Layout3 , Index3 )
1688 If ( P r e s e n t ( Index4 ) ) Call GraphStyle ( Style4 , Layout4 , Index4 )
1689 If ( P r e s e n t ( Index5 ) ) Call GraphStyle ( Style5 , Layout5 , Index5 )
1690 If ( P r e s e n t ( Index6 ) ) Call GraphStyle ( Style6 , Layout6 , Index6 )
1691 If ( P r e s e n t ( Index7 ) ) Call GraphStyle ( Style7 , Layout7 , Index7 )
1692 If ( P r e s e n t ( Index8 ) ) Call GraphStyle ( Style8 , Layout8 , Index8 )
1693 If ( P r e s e n t ( Index9 ) ) Call GraphStyle ( Style9 , Layout9 , Index9 )
1694
1695 Write (10 , * ) ’ s e t log x ’
1696
1697 I f ( P r e s e n t ( I n d e x 9 ) ) Then
1698 W r i t e ( 1 0 , ’ (A, 9 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ ’ , I n d e x 8 , ’ ’ , I n d e x 9 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) )
: 1 with l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1699 E l s e I f ( P r e s e n t ( I n d e x 8 ) ) Then
1700 W r i t e ( 1 0 , ’ (A, 8 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ ’ , I n d e x 8 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h
l i n e s l s ( n ) t i t l e columnheader ( n +1) ’
1701 E l s e I f ( P r e s e n t ( I n d e x 7 ) ) Then
1702 W r i t e ( 1 0 , ’ (A, 7 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ ’ , I n d e x 7 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n )
t i t l e columnheader ( n +1) ’
1703 E l s e I f ( P r e s e n t ( I n d e x 6 ) ) Then
1704 W r i t e ( 1 0 , ’ (A, 6 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ ’ , I n d e x 6 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e
columnheader ( n +1) ’
1705 E l s e I f ( P r e s e n t ( I n d e x 5 ) ) Then
1706 W r i t e ( 1 0 , ’ (A, 5 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ ’ ,
I n d e x 5 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1707 E l s e I f ( P r e s e n t ( I n d e x 4 ) ) Then
1708 W r i t e ( 1 0 , ’ (A, 4 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ ’ , I n d e x 4 , ’ " ] "
x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1709 E l s e I f ( P r e s e n t ( I n d e x 3 ) ) Then
1710 W r i t e ( 1 0 , ’ (A, 3 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ ’ , I n d e x 2 , ’ ’ , I n d e x 3 , ’ " ] " x y d a t a 1 . d a t "
u s i n g ( column ( n + 1 ) ) : 1 w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) ’
1711 Else
1712 W r i t e ( 1 0 , ’ (A, 2 ( I3 , A) ) ’ ) ’ p l o t f o r [ n i n " ’ , I n d e x 1 , ’ " ] " x y d a t a 1 . d a t " u s i n g ( column ( n + 1 ) ) : 1
w i t h l i n e s l s ( n ) t i t l e c o l u m n h e a d e r ( n + 1 ) , f o r [m i n " ’ , I n d e x 2 , ’ " ] " x y d a t a 2 . d a t " u s i n g (
column (m+ 1 ) ) : 1 w i t h l i n e s l s (m) t i t l e c o l u m n h e a d e r (m+ 1 ) ’
1713 End I f
1714
1715 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1716
1717 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1718 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1719 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1720
1721 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d .
1722
1723 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1724 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
1725 C a l l SYSTEM( ’ d e l x y d a t a 2 . d a t ’ )
1726
1727 ! Check m e s s a g e
1728 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1729 W r i t e ( * , ’ (A) ’ ) ’ F i l e ’ / / ’ " ’ / / ’ P l o t ’ / / t r i m ( t i t l e ) / / ’ . png ’ / / ’ " ’ / / ’ i s c r e a t e d . ’
1730
1731 End S u b r o u t i n e
1732
1733 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1734
1735 S u b r o u t i n e f 2 g p S c e n a r i o s ( ID , t i t l e , x l a b e l , y l a b e l , s t y l e 0 , s t y l e 1 , s t y l e 2 , s t y l e 3 , s t y l e 4 , s t y l e 5 ,
style6 , style7 , style8 , style9 )
258 F. Code of the MarsdiepVisual Program

1736
1737 Character (*) , Parameter :: filefolder_out = "D : \ h i j n e k a m \ D e s k t o p \ Program \
ProgramOutput \ " ! Outputfiles
1738 Integer : : Temp=21
1739 Integer : : Y, n0 , i
1740 Character (*) : : ID ! Sample ID . , u s e d
f o r t i t l e o f g r a p h and g r a p h f i l e n a m e .
1741 Character (2) :: style1 , style2 , style3 , style4 , style5 , style6 , style7 ,
style8 , style9 , style0
1742 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel
1743 C h a r a c t e r ( l e n =* ) :: title
1744 Character (11) :: g_title1 , g_title2 , g_title3 , g_title4 , g_title5 , g_title6 ,
g_title7 , g_title8 , g_title9 , g_title0
1745 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7
, Layout8 , Layout9 , L a y o u t 0
1746 Character (150) :: Filename1 , Filename2 , Filename3 , Filename4 , Filename5 , Filename6 ,
Filename7 , Filename8 , Filename9 , Filename0
1747 Character (19) :: DateTimeSource
1748 C h a r a c t e r ( 1 9 ) , A l l o c a t a b l e : : Var ( : )
1749 Character (19) : : DateTimeMin
1750 Character (19) : : DateTimeMax
1751
1752 W r i t e ( F i l e n a m e 0 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ Away S c e n a r i o 0 1 . t x t ’ ! T h i s i s t h e same f o r a l l s c e n a r i o s f o r one
s a m p l e s s i n c e i t d e p e n d s on t h e s a m p l i n g t i m e which i s c o n s t a n t .
1753 W r i t e ( F i l e n a m e 1 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 1 . txt ’
1754 W r i t e ( F i l e n a m e 2 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 2 . txt ’
1755 W r i t e ( F i l e n a m e 3 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 3 . txt ’
1756 W r i t e ( F i l e n a m e 4 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 4 . txt ’
1757 W r i t e ( F i l e n a m e 5 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 5 . txt ’
1758 W r i t e ( F i l e n a m e 6 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 6 . txt ’
1759 W r i t e ( F i l e n a m e 7 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 7 . txt ’
1760 W r i t e ( F i l e n a m e 8 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 8 . txt ’
1761 W r i t e ( F i l e n a m e 9 , ’ (A, A, A, I 2 . 2 ,A) ’ ) ’D : / h i j n e k a m / D e s k t o p / Program / P r o g r a m O u t p u t / S c e n a r i o s /’,
t r i m ( ID ) , ’ PumpedVol S c e n a r i o 0 9 . txt ’
1762
1763 Open ( Temp , f i l e = F i l e n a m e 0 )
1764 n0 = l i n e c o u n t ( Temp )
1765
1766 A l l o c a t e ( Var ( n0 ) )
1767
1768 Do i =1 , n0
1769 Read ( Temp , ’ (A) ’ ) Var ( i )
1770 I f ( v a r ( i ) . eq . " " ) v a r ( i ) = " "
1771 End Do
1772
1773 D a t e T i m e S o u r c e = Var ( n0 )
1774
1775 D e a l l o c a t e ( Var )
1776 C l o s e ( Temp )
1777
1778 Y = 12 ! Amount o f h o u r s t h a t w i l l be s u b s t r a c t e d from t h e s o u r c e d a t e t i m e and a d d e d
t o i t , i n o r d e r t o r e s p e c t i v e l y form t h e mimimum and maximum o f t h e zoomed p l o t
1779 C a l l ZoomGPHours ( D a t e T i m e S o u r c e , DateTimeMin , DateTimeMax , Y)
1780
1781 g_title0 = ’Away ’
1782 g_title1 = ’ Scenario 01 ’
1783 g_title2 = ’ Scenario 02 ’
1784 g_title3 = ’ Scenario 03 ’
1785 g_title4 = ’ Scenario 04 ’
1786 g_title5 = ’ Scenario 05 ’
1787 g_title6 = ’ Scenario 06 ’
1788 g_title7 = ’ Scenario 07 ’
259

1789 g_title8 = ’ S c e n a r i o 08 ’
1790 g_title9 = ’ S c e n a r i o 09 ’
1791
1792 ! C r e a t e g n u p l o t command f i l e
1793 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1794 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1795 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 1 8 0 0 , 1 8 0 0 ’ ! Sets i t to
c r e a t e . png
1796 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t S c e n a r i o s /
P l o t _ S c e n a r i o s _ ’ / / t r i m ( ID ) / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n
a d i f f e r e n t f o l d e r . The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
1797
1798 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e f o n t " , 2 8 " ’ / / ’ " { / : Bold ’ / / t r i m ( T i t l e ) / / ’ } " ’ ! Graph T i t l e ,
t i t l e in bold
1799 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x d a t a t i m e ’
1800 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i m e f m t ’ ’%d−%m−%Y %H:%M:%S ’ ’ ’
1801 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l f o n t " , 2 4 " ’ / / ’ " ’ / / TRIM ( x l a b e l ) / / ’ " o f f s e t 0 , − 1 . 5 ’ !
O f f s e t c h a n g e s t h e p o s i t i o n o f t h e t i t l e , i n t h i s c a s e l o w e r s i t , w / o i t t h e t i t l e and
t i c l a b e l s o v e r l a p . F i r s t number o f f s e t s t h e h o r i z o n t a l p o s i t i o n .
1802 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y l a b e l f o n t " , 2 4 " ’ / / ’ " ’ / / TRIM ( y l a b e l ) / / ’ " ’
1803
1804 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key f o n t " , 2 0 " o p a q u e r i g h t t o p box ’
1805
1806 W r i t e ( 1 0 , ’ ( 5 (A) ) ’ ) ’ s e t x r a n g e [ " ’ , DateTimeMin , ’ " : " ’ , DateTimeMax , ’ " ] ’
1807 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t yrange [ 0 : * ] ’
1808
1809 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d ’
1810
1811 W r i t e ( 1 0 , ’ (A) ’ ) ’ set lmargin at screen 0.05 ’
1812 ! W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t rmargin at screen 0.85 ’
1813 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t bmargin a t screen 0.06 ’
1814 W r i t e ( 1 0 , ’ (A) ’ ) ’ set tmargin at screen 0.95 ’
1815
1816 Call GraphStyle ( Style1 , Layout1 )
1817 Call GraphStyle ( Style2 , Layout2 )
1818 Call GraphStyle ( Style3 , Layout3 )
1819 Call GraphStyle ( Style4 , Layout4 )
1820 Call GraphStyle ( Style5 , Layout5 )
1821 Call GraphStyle ( Style6 , Layout6 )
1822 Call GraphStyle ( Style7 , Layout7 )
1823 Call GraphStyle ( Style8 , Layout8 )
1824 Call GraphStyle ( Style9 , Layout9 )
1825 Call GraphStyle ( Style0 , Layout0 )
1826
1827 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " ’ / / t r i m ( f i l e n a m e 0 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 0 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 0 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 1 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 1 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 2 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 2 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 2 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 3 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 3 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 4 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 4 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 5 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 5 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 6 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 6 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 7 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 7 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 8 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 8 ) / / ’ " , " ’ / / t r i m ( f i l e n a m e 9 ) / / ’ " u s i n g 1 : 3 w i t h ’ / / t r i m ( L a y o u t 9 ) / / ’ t i t l e " ’ / /
TRIM ( g _ t i t l e 9 ) / / ’ " ’ ! B e c a u s e G n u p l o t r e a d s t i m e and d a t a a s two s e p a r a t e c o l u m n s
t h e y − d a t a becomes column 3 .
1828
1829 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1830
1831 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1832 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1833 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1834
1835 ! Pause ! E n a b l e t o c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s
expected .
1836
1837 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1838
1839 ! Check m e s s a g e
1840 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1841 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t S c e n a r i o s ’ / / t r i m ( ID ) / / ’ . png " i s c r e a t e d . ’
260 F. Code of the MarsdiepVisual Program

1842
1843 End S u b r o u t i n e
1844
1845 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1846
1847 S u b r o u t i n e f2gpwBGFm ( S c e n a r i o N o , BackgroundName , t i t l e , x l a b e l , y l a b e l , F i l e 1 , g t i t l e 1 , S t y l e 1 , F i l e 2
, g t i t l e 2 , Style2 , File3 , g t i t l e 3 , Style3 , File4 , g t i t l e 4 , Style4 , File5 , g t i t l e 5 , Style5 , File6 ,
g t i t l e 6 , Style6 , File7 , g t i t l e 7 , Style7 , File8 , g t i t l e 8 , Style8 )
1848 ! I m p l e m e n t a p i c t u r e f o r t h e b a c k g r o u n d . Based on a m o n g s t o t h e r s ; h t t p : / / www. g n u p l o t t i n g .
o r g / t a g / image / .
1849 ! And p l o t s r e s u l t s o f t h e Sample S o u r c e p r o g r a m on t o p o f i t .
1850 I m p l i c i t None
1851
1852 Character (*) :: File1 , File2 , File3 , File4 , File5 , File6 , File7 , File8
1853 Character (*) :: gtitle1 , gtitle2 , gtitle3 , gtitle4 , gtitle5 , gtitle6 , gtitle7 , gtitle8
1854 Character (2) :: Style1 , Style2 , Style3 , Style4 , Style5 , Style6 , Style7 , Style8
1855 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 ,
Layout8
1856 Character (*) :: title
1857 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel
1858 Integer :: ScenarioNo
1859 Character (50) :: F i l e n a m e , BackgroundName
1860 Character (50) :: Command
1861
1862 ! C r e a t e g n u p l o t command f i l e
1863 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1864 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1865 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t e r m i n a l p n g c a i r o s i z e 4 8 0 0 , 2 8 0 0 ’ ! linewidth 2.0 font " ,40"
s i z e 2000 ,1000 ’
1866 W r i t e ( F i l e n a m e , ’ (A, I 2 . 2 ,A) ’ ) t r i m ( BackgroundName ) / / " _ S c e n a r i o _ " , S c e n a r i o N o , " . png "
1867 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / C r o s s S e c t i o n s / ’ / / t r i m
( Filename ) / / ’ " ’
1868 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t t i t l e " ’ / / t r i m ( t i t l e ) / / ’ " f o n t " , 3 2 " ’
1869
1870 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s i z e 0 . 9 ’
1871 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o r i g i n 0 . 0 5 , 0 . 0 5 ’
1872
1873 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ − 650 : 6110 ] ’ ! Found m a n u a l l y b a s e d on
the picture used , s i n c e i t a l r e a d y c o n t a i n s a s c a l e . . .
1874 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x t i c s o u t n o m i r r o r r o t a t e by −90 ’
1875 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,4 ’
1876 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x2range [ 0 : * ] ’ ! noreverse nowriteback ’
1877 W r i t e ( 1 0 , ’ (A) ’ ) ’ unset x2tics ’
1878
1879 Write (10 , ’ (A) ’) ’ s e t y r a n g e [ − 153.5 : 32 ] ’ ! Idem d i t o . . .
1880 Write (10 , ’ (A) ’) ’ unset ytics ’
1881 Write (10 , ’ (A) ’) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 2 8 " o f f s e t − 4 ,0 ’
1882 Write (10 , ’ (A) ’) ’ s e t y2range [ 0 : * ] ’ ! noreverse nowriteback ’
1883 Write (10 , ’ (A) ’) ’ unset y2tics ’
1884
1885 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t g r i d f r o n t lw 3 ’
1886
1887 Write (10 , ’ (A) ’) ’ set lmargin at screen 0.03 ’
1888 Write (10 , ’ (A) ’) ’ set rmargin at screen 0.99 ’
1889 Write (10 , ’ (A) ’) ’ set bmargin at screen 0.06 ’
1890 Write (10 , ’ (A) ’) ’ set tmargin at screen 0.95 ’
1891
1892 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t key a t 2825 , − 100 L e f t r e v e r s e box l t −1 o p a q u e f o n t " , 2 4 " ’
1893
1894 Call GraphStyle ( Style1 , Layout1 )
1895 Call GraphStyle ( Style2 , Layout2 )
1896 Call GraphStyle ( Style3 , Layout3 )
1897 Call GraphStyle ( Style4 , Layout4 )
1898 Call GraphStyle ( Style5 , Layout5 )
1899 Call GraphStyle ( Style6 , Layout6 )
1900 Call GraphStyle ( Style7 , Layout7 )
1901 Call GraphStyle ( Style8 , Layout8 )
1902
1903 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e c i r c l e r a d i u s g r a p h 0 . 0 0 3 ’
1904
1905 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " ’ / / t r i m ( BackgroundName ) / / ’ . png " b i n a r y f i l e t y p e =png u s i n g 1 : 2 : 3 : ( 2 2 5 )
261

w i t h r g b a l p h a n o t i t l e a x e s x2y2 , " ’ / / t r i m ( f i l e 1 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m


( L a y o u t 1 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s x1y1 t i t l e " ’ / / t r i m ( g t i t l e 1 ) / / ’ " , " ’ / / t r i m (
f i l e 2 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 2 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s
x1y1 t i t l e " ’ / / t r i m ( g t i t l e 2 ) / / ’ " , " ’ / / t r i m ( f i l e 3 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / /
t r i m ( L a y o u t 3 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s x1y1 t i t l e " ’ / / t r i m ( g t i t l e 3 ) / / ’ " , " ’ / / t r i m (
f i l e 4 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s
x1y1 t i t l e " ’ / / t r i m ( g t i t l e 4 ) / / ’ " , " ’ / / t r i m ( f i l e 5 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / /
t r i m ( L a y o u t 5 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s x1y1 t i t l e " ’ / / t r i m ( g t i t l e 5 ) / / ’ " , " ’ / / t r i m (
f i l e 6 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s
x1y1 t i t l e " ’ / / t r i m ( g t i t l e 6 ) / / ’ " , " ’ / / t r i m ( f i l e 7 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / /
t r i m ( L a y o u t 7 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s x1y1 t i t l e " ’ / / t r i m ( g t i t l e 7 ) / / ’ " , " ’ / / t r i m (
f i l e 8 ) / / ’ " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ f i l l s o l i d b o r d e r l t −1 a x e s
x1y1 t i t l e " ’ / / t r i m ( g t i t l e 8 ) / / ’ " ’
1906
1907 ! The v a l u e b e t w e e n b r a c k e t s i n t h e 1 : 2 : 3 : ( X) p a r t n e e d s t o be b e t w e e n 0 ( f u l l y t r a n s p a r a n t
) and 255 ( f u l l y o p a q u e ) .
1908
1909 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
1910
1911 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
1912 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1913 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
1914
1915 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d .
1916
1917 C a l l SYSTEM( ’ d e l gp . t x t ’ )
1918
1919 ! Check m e s s a g e
1920 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1921 W r i t e ( * , ’ (A) ’ ) ’ F i l e " ’ / / t r i m ( f i l e n a m e ) / / ’ " i s c r e a t e d . ’
1922
1923 End S u b r o u t i n e
1924
1925 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1926
1927 S u b r o u t i n e f 2 g p D a t a ( L o c a t i o n , name , t i t l e , x l a b e l , y l a b e l , x d a t a , y d a t a 1 , g r a p h _ t i t l e 1 , s t y l e 1 ,
ydata2 , g r a p h _ t i t l e 2 , s t y l e 2 , ydata3 , g r a p h _ t i t l e 3 , s t y l e 3 , ydata4 , g r a p h _ t i t l e 4 , s t y l e 4 ,
ydata5 , g r a p h _ t i t l e 5 , s t y l e 5 , ydata6 , g r a p h _ t i t l e 6 , s t y l e 6 , ydata7 , g r a p h _ t i t l e 7 , s t y l e 7
, ydata8 , g r a p h _ t i t l e 8 , s t y l e 8 , ydata9 , g r a p h _ t i t l e 9 , s t y l e 9 , ydata10 , g r a p h _ t i t l e 1 0 ,
style10 )
1928 ! S u b r o u t i n e f2gpRHData p l o t s t h e r e s u l t s o f t h e v i s c o m e t e r
1929 I m p l i c i t None
1930
1931 Integer : : n1 ! number o f d a t a p o i n t s
1932 Character (*) :: xdata ( : ) ! f i r s t x data array
1933 Real :: ydata1 ( : )
1934 Real , Optional :: ydata2 ( : ) , ydata3 ( : ) , ydata4 ( : ) , ydata5 ( : ) , ydata6 ( : ) , ydata7 ( : ) , ydata8
( : ) , ydata9 ( : ) , ydata10 ( : )
1935 C h a r a c t e r ( l e n =* ) :: x l a b e l , y l a b e l , t i t l e , name ! p l o t a x i s l a b e l s and
title (s)
1936 Character (10) :: Location
1937 Integer :: i
1938 Character (*) :: graph_title1
1939 Character (*) , Optional :: graph_title2 , graph_title3 , graph_title4 , graph_title5 ,
graph_title6 , graph_title7 , graph_title8 , graph_title9 , graph_title10
1940 Character (2) :: style1
1941 Character (2) , Optional :: style2 , style3 , style4 , style5 , style6 , style7 , style8 , style9 ,
style10
1942 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 ,
Layout8 , Layout9 , L a y o u t 1 0
1943
1944 n1 = s i z e ( x d a t a )
1945
1946 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1947 ! Write data in f i l e s
1948 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1949 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
1950
1951 I f ( P r e s e n t ( y d a t a 1 0 ) ) Then
1952 Do i =1 , n1
1953 W r i t e ( 1 0 , ’ (A, I , 1 0 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
262 F. Code of the MarsdiepVisual Program

ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i ) , ydata9 ( i ) , ydata10 ( i )


1954 End Do
1955 E l s e I f ( P r e s e n t ( y d a t a 9 ) ) Then
1956 Do i =1 , n1
1957 W r i t e ( 1 0 , ’ (A, I , 9 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i ) , ydata5 ( i ) ,
ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i ) , ydata9 ( i )
1958 End Do
1959 E l s e I f ( P r e s e n t ( y d a t a 8 ) ) Then
1960 Do i =1 , n1
1961 W r i t e ( 1 0 , ’ (A, I , 8 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i ) , ydata5 ( i ) ,
ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i )
1962 End Do
1963 E l s e I f ( P r e s e n t ( y d a t a 7 ) ) Then
1964 Do i =1 , n1
1965 W r i t e ( 1 0 , ’ (A, I , 7 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i ) , ydata5 ( i ) ,
ydata6 ( i ) , ydata7 ( i )
1966 End Do
1967 E l s e I f ( P r e s e n t ( y d a t a 6 ) ) Then
1968 Do i =1 , n1
1969 W r i t e ( 1 0 , ’ (A, I , 6 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i ) , ydata5 ( i ) ,
ydata6 ( i )
1970 End Do
1971 E l s e I f ( P r e s e n t ( y d a t a 5 ) ) Then
1972 Do i =1 , n1
1973 W r i t e ( 1 0 , ’ (A, I , 5 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i ) , ydata5 ( i )
1974 End Do
1975 E l s e I f ( P r e s e n t ( y d a t a 4 ) ) Then
1976 Do i =1 , n1
1977 W r i t e ( 1 0 , ’ (A, I , 4 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i ) , ydata4 ( i )
1978 End Do
1979 E l s e I f ( P r e s e n t ( y d a t a 3 ) ) Then
1980 Do i =1 , n1
1981 W r i t e ( 1 0 , ’ (A, I , 3 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , ydata3 ( i )
1982 End Do
1983 E l s e I f ( P r e s e n t ( y d a t a 2 ) ) Then
1984 Do i =1 , n1
1985 W r i t e ( 1 0 , ’ (A, I , 2 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i )
1986 End Do
1987 Else
1988 Do i =1 , n1
1989 W r i t e ( 1 0 , ’ (A, I , F ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i )
1990 End Do
1991 End I f
1992
1993 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
1994
1995 ! C r e a t e g n u p l o t command f i l e
1996 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
1997 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
1998 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 4 0 0 , 8 0 0 ’ ! Sets i t to create .
png
1999 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( S h o r t (
L o c a t i o n ) ) / / ’ _ ’ / / t r i m ( Name ) / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t
i n a d i f f e r e n t f o l d e r . The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2000 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ } " ’ ! Graph T i t l e , t i t l e i n
b o l d , works
2001 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’
2002 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " ’
2003
2004 W r i t e ( 1 0 , * ) ’ s e t key L e f t r i g h t o u t s i d e ’
2005
2006 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −45 ’
2007 Write (10 , * ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
2008
2009 C a l l GraphStyle ( Style1 , Layout1 )
2010 I f ( Present ( Style2 ) ) Call GraphStyle ( Style2 , Layout2 )
2011 I f ( Present ( Style3 ) ) Call GraphStyle ( Style3 , Layout3 )
2012 I f ( Present ( Style4 ) ) Call GraphStyle ( Style4 , Layout4 )
2013 I f ( Present ( Style5 ) ) Call GraphStyle ( Style5 , Layout5 )
2014 I f ( Present ( Style6 ) ) Call GraphStyle ( Style6 , Layout6 )
2015 I f ( Present ( Style7 ) ) Call GraphStyle ( Style7 , Layout7 )
263

2016 I f ( P r e s e n t ( S t y l e 8 ) ) C a l l GraphStyle ( Style8 , Layout8 )


2017 I f ( P r e s e n t ( S t y l e 9 ) ) C a l l GraphStyle ( Style9 , Layout9 )
2018 I f ( P r e s e n t ( S t y l e 1 0 ) ) C a l l GraphStyle ( Style10 , Layout10 )
2019
2020 I f ( P r e s e n t ( y d a t a 1 0 ) ) Then
2021 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 2 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 0 ) / /
’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 0 ) / / ’ " ’
2022 E l s e I f ( P r e s e n t ( y d a t a 9 ) ) Then
2023 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " ’
2024 E l s e I f ( P r e s e n t ( y d a t a 8 ) ) Then
2025 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
graph_title8 ) // ’" ’
2026 E l s e I f ( P r e s e n t ( y d a t a 7 ) ) Then
2027 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) // ’" ’
2028 E l s e I f ( P r e s e n t ( y d a t a 6 ) ) Then
2029 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " ’
2030 E l s e I f ( P r e s e n t ( y d a t a 5 ) ) Then
2031 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " ’
2032 E l s e I f ( P r e s e n t ( y d a t a 4 ) ) Then
2033 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " ’
264 F. Code of the MarsdiepVisual Program

2034 E l s e I f ( P r e s e n t ( y d a t a 3 ) ) Then
2035 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " ’
2036 E l s e I f ( P r e s e n t ( y d a t a 2 ) ) Then
2037 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " ’
2038 Else
2039 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " ’
2040 End I f
2041
2042 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2043
2044 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2045 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2046 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2047
2048 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2049
2050 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2051 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2052
2053 ! Check m e s s a g e
2054 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2055 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png " i s c r e a t e d . ’
2056
2057 End S u b r o u t i n e
2058
2059 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2060
2061 S u b r o u t i n e f2gpYPData ( L o c a t i o n , name , t i t l e , x l a b e l , y l a b e l , x d a t a , y d a t a 1 , g r a p h _ t i t l e 1 , s t y l e 1 ,
ydata2 , g r a p h _ t i t l e 2 , s t y l e 2 , ydata3 , g r a p h _ t i t l e 3 , s t y l e 3 , ydata4 , g r a p h _ t i t l e 4 , s t y l e 4 ,
ydata5 , g r a p h _ t i t l e 5 , s t y l e 5 , ydata6 , g r a p h _ t i t l e 6 , s t y l e 6 , ydata7 , g r a p h _ t i t l e 7 , s t y l e 7
, ydata8 , g r a p h _ t i t l e 8 , s t y l e 8 , ydata9 , g r a p h _ t i t l e 9 , s t y l e 9 , ydata10 , g r a p h _ t i t l e 1 0 ,
style10 )
2062 ! S u b r o u t i n e f2gpRHData p l o t s t h e r e s u l t s o f t h e v i s c o m e t e r
2063 I m p l i c i t None
2064
2065 Integer : : n1 ! number o f d a t a p o i n t s
2066 Character (*) :: xdata ( : ) ! f i r s t x data array
2067 Real :: ydata1 ( : )
2068 Real , Optional :: ydata2 ( : ) , ydata3 ( : ) , ydata4 ( : ) , ydata5 ( : ) , ydata6 ( : ) , ydata7 ( : ) , ydata8
( : ) , ydata9 ( : ) , ydata10 ( : )
2069 C h a r a c t e r ( l e n =* ) :: x l a b e l , y l a b e l , t i t l e , name ! p l o t a x i s l a b e l s and
title (s)
2070 Character (10) :: Location
2071 Integer :: i
2072 Character (*) :: graph_title1
2073 Character (*) , Optional :: graph_title2 , graph_title3 , graph_title4 , graph_title5 ,
graph_title6 , graph_title7 , graph_title8 , graph_title9 , graph_title10
2074 Character (2) :: style1
2075 Character (2) , Optional :: style2 , style3 , style4 , style5 , style6 , style7 , style8 , style9 ,
style10
2076 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , Layout6 , Layout7 ,
Layout8 , Layout9 , L a y o u t 1 0
2077 Character (25) :: Layout99
2078
2079 n1 = s i z e ( x d a t a )
2080
2081 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2082 ! Write data in f i l e s
2083 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2084 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2085
2086 I f ( P r e s e n t ( y d a t a 1 0 ) ) Then
2087 Do i =1 , n1
2088 W r i t e ( 1 0 , ’ (A, I , 1 0 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
265

ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i ) , ydata9 ( i ) , ydata10 ( i )


2089 End Do
2090 E l s e I f ( P r e s e n t ( y d a t a 9 ) ) Then
2091 Do i =1 , n1
2092 W r i t e ( 1 0 , ’ (A, I , 9 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i ) , ydata9 ( i )
2093 End Do
2094 E l s e I f ( P r e s e n t ( y d a t a 8 ) ) Then
2095 Do i =1 , n1
2096 W r i t e ( 1 0 , ’ (A, I , 8 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
ydata6 ( i ) , ydata7 ( i ) , ydata8 ( i )
2097 End Do
2098 E l s e I f ( P r e s e n t ( y d a t a 7 ) ) Then
2099 Do i =1 , n1
2100 W r i t e ( 1 0 , ’ (A, I , 7 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
ydata6 ( i ) , ydata7 ( i )
2101 End Do
2102 E l s e I f ( P r e s e n t ( y d a t a 6 ) ) Then
2103 Do i =1 , n1
2104 W r i t e ( 1 0 , ’ (A, I , 6 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i ) ,
ydata6 ( i )
2105 End Do
2106 E l s e I f ( P r e s e n t ( y d a t a 5 ) ) Then
2107 Do i =1 , n1
2108 W r i t e ( 1 0 , ’ (A, I , 5 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 5 ( i )
2109 End Do
2110 E l s e I f ( P r e s e n t ( y d a t a 4 ) ) Then
2111 Do i =1 , n1
2112 I f ( y d a t a 1 ( i ) < y d a t a 2 ( i ) ) Then
2113 W r i t e ( 1 0 , ’ (A, I , 5 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 3 (
i)
2114 E l s e I f ( y d a t a 1 ( i ) > y d a t a 2 ( i ) ) Then
2115 W r i t e ( 1 0 , ’ (A, I , 5 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i ) , y d a t a 4 ( i ) , y d a t a 4 (
i)
2116 End I f
2117 End Do
2118 E l s e I f ( P r e s e n t ( y d a t a 3 ) ) Then
2119 Do i =1 , n1
2120 W r i t e ( 1 0 , ’ (A, I , 3 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i ) , y d a t a 3 ( i )
2121 End Do
2122 E l s e I f ( P r e s e n t ( y d a t a 2 ) ) Then
2123 Do i =1 , n1
2124 W r i t e ( 1 0 , ’ (A, I , 2 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i ) , y d a t a 2 ( i )
2125 End Do
2126 Else
2127 Do i =1 , n1
2128 W r i t e ( 1 0 , ’ (A, I , F ) ’ ) x d a t a ( i ) , i , y d a t a 1 ( i )
2129 End Do
2130 End I f
2131
2132 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
2133
2134 ! C r e a t e g n u p l o t command f i l e
2135 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2136 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2137 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 2 0 0 , 6 0 0 ’ ! Sets i t to create .
png
2138 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( S h o r t (
L o c a t i o n ) ) / / ’ _ ’ / / t r i m ( Name ) / / ’ _Dev . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s
i t i n a d i f f e r e n t f o l d e r . The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2139 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( L o c a t i o n ) / / ’ ’ / / T i t l e / / ’ } " f o n t " , 2 0 " ’
! Graph T i t l e , t i t l e i n b o l d , works
2140 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 1 8 " ’
2141 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " f o n t " , 1 8 " ’
2142 Write (10 , * ) ’ s e t yrange [ 0 : 1 5 0 ] ’
2143 Write (10 , * ) ’ s e t y t i c s 0 ,25 ,150 ’
2144 W r i t e ( 1 0 , * ) ’ s e t y 2 l a b e l " Y i e l d S t r e s s [ Pa ] " f o n t " , 1 8 " ’
2145 Write (10 , * ) ’ s e t y2range [ 0 : 3 0 ] ’
2146 Write (10 , * ) ’ s e t y 2 t i c s 0 ,5 ,30 ’
2147
2148 W r i t e ( 1 0 , * ) ’ s e t key l e f t i n s i d e box f o n t " , 1 6 " ’
266 F. Code of the MarsdiepVisual Program

2149
2150 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −90 ’ ! s a m p l e c o d e on t h e r i g h t m i s s e s a p a r t i f −45
2151 Write (10 , * ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
2152
2153 C a l l GraphStyle ( Style1 , Layout1 )
2154 I f ( P r e s e n t ( S t y l e 2 ) ) C a l l GraphStyle ( Style2 , Layout2 )
2155 I f ( P r e s e n t ( S t y l e 3 ) ) C a l l GraphStyle ( Style3 , Layout3 )
2156 I f ( P r e s e n t ( S t y l e 4 ) ) C a l l GraphStyle ( Style4 , Layout4 )
2157 I f ( P r e s e n t ( S t y l e 5 ) ) C a l l GraphStyle ( Style5 , Layout5 )
2158 I f ( P r e s e n t ( S t y l e 6 ) ) C a l l GraphStyle ( Style6 , Layout6 )
2159 I f ( P r e s e n t ( S t y l e 7 ) ) C a l l GraphStyle ( Style7 , Layout7 )
2160 I f ( P r e s e n t ( S t y l e 8 ) ) C a l l GraphStyle ( Style8 , Layout8 )
2161 I f ( P r e s e n t ( S t y l e 9 ) ) C a l l GraphStyle ( Style9 , Layout9 )
2162 I f ( P r e s e n t ( S t y l e 1 0 ) ) C a l l GraphStyle ( Style10 , Layout10 )
2163
2164 C a l l G r a p h S t y l e ( ’ 1m’ , L a y o u t 9 9 )
2165
2166 I f ( P r e s e n t ( y d a t a 1 0 ) ) Then
2167 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 2 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 0 ) / /
’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 0 ) / / ’ " ’
2168 E l s e I f ( P r e s e n t ( y d a t a 9 ) ) Then
2169 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " ’
2170 E l s e I f ( P r e s e n t ( y d a t a 8 ) ) Then
2171 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
graph_title8 ) // ’" ’
2172 E l s e I f ( P r e s e n t ( y d a t a 7 ) ) Then
2173 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) // ’" ’
2174 E l s e I f ( P r e s e n t ( y d a t a 6 ) ) Then
2175 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " ’
267

2176 E l s e I f ( P r e s e n t ( y d a t a 5 ) ) Then
2177 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " ’
2178 E l s e I f ( P r e s e n t ( y d a t a 4 ) ) Then
2179 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " a x e s x1y1 , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’
/ / t r i m ( L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " a x e s x1y1 , " x y d a t a 1 . d a t " u s i n g 2 : 5 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " a x e s x1y2 , "
x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4
) / / ’ " a x e s x1y2 , " x y d a t a 1 . d a t " u s i n g 2 : 7 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 9 9 ) / / ’ t i t l e " ’
/ / TRIM ( t i t l e ) / / ’ " a x e s x1y2 ’
2180 E l s e I f ( P r e s e n t ( y d a t a 3 ) ) Then
2181 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " ’
2182 E l s e I f ( P r e s e n t ( y d a t a 2 ) ) Then
2183 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " ’
2184 Else
2185 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " ’
2186 End I f
2187
2188 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2189
2190 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp2 . t x t ’ )
2191 W r i t e ( 1 0 , * ) ’ s e t t e r m i n a l png s i z e 2 2 0 0 , 9 0 0 ’ ! Sets i t to create .
png
2192 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( S h o r t (
L o c a t i o n ) ) / / ’ _ ’ / / t r i m ( Name ) / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t
i n a d i f f e r e n t f o l d e r . The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2193 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t r i m ( L o c a t i o n ) / / ’ ’ / / T i t l e / / ’ } " f o n t " , 2 0 " ’
! Graph T i t l e , t i t l e i n b o l d , works
2194 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 1 8 " ’
2195 Write (10 , * ) ’ s e t yrange [ 0 : 3 0 ] ’
2196 ! Write (10 , * ) ’ s e t y t i c s 0 ,25 ,150 ’
2197 W r i t e ( 1 0 , * ) ’ s e t y l a b e l " Y i e l d S t r e s s [ Pa ] " f o n t " , 1 8 " ’
2198 ! Write (10 , * ) ’ s e t y2range [ 0 : 3 0 ] ’
2199 ! Write (10 , * ) ’ s e t y 2 t i c s 0 ,5 ,30 ’
2200
2201 W r i t e ( 1 0 , * ) ’ s e t key l e f t i n s i d e box f o n t " , 1 6 " ’
2202
2203 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −90 ’
2204 Write (10 , * ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
2205
2206 C a l l GraphStyle ( Style1 , Layout1 )
2207 I f ( P r e s e n t ( S t y l e 2 ) ) C a l l GraphStyle ( Style2 , Layout2 )
2208 I f ( P r e s e n t ( S t y l e 3 ) ) C a l l GraphStyle ( Style3 , Layout3 )
2209 I f ( P r e s e n t ( S t y l e 4 ) ) C a l l GraphStyle ( Style4 , Layout4 )
2210 I f ( P r e s e n t ( S t y l e 5 ) ) C a l l GraphStyle ( Style5 , Layout5 )
2211 I f ( P r e s e n t ( S t y l e 6 ) ) C a l l GraphStyle ( Style6 , Layout6 )
2212 I f ( P r e s e n t ( S t y l e 7 ) ) C a l l GraphStyle ( Style7 , Layout7 )
2213 I f ( P r e s e n t ( S t y l e 8 ) ) C a l l GraphStyle ( Style8 , Layout8 )
2214 I f ( P r e s e n t ( S t y l e 9 ) ) C a l l GraphStyle ( Style9 , Layout9 )
2215 I f ( P r e s e n t ( S t y l e 1 0 ) ) C a l l GraphStyle ( Style10 , Layout10 )
2216
2217 C a l l G r a p h S t y l e ( ’ 1m’ , L a y o u t 9 9 )
2218 C a l l G r a p h S t y l e ( ’ 3k ’ , Layout3 )
2219 C a l l GraphStyle ( ’3 l ’ , Layout4 )
2220
2221 I f ( P r e s e n t ( y d a t a 1 0 ) ) Then
2222 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
268 F. Code of the MarsdiepVisual Program

( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :


x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 2 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 0 ) / /
’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 0 ) / / ’ " ’
2223 E l s e I f ( P r e s e n t ( y d a t a 9 ) ) Then
2224 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 8 ) / / ’ " , " xydata1 . d a t " using 2 : 1 1 : x t i c l a b e l s ( 1 ) with ’ / / t r i m ( Layout9 ) / / ’ t i t l e "
’ / / TRIM ( g r a p h _ t i t l e 9 ) / / ’ " ’
2225 E l s e I f ( P r e s e n t ( y d a t a 8 ) ) Then
2226 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 1 0 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 8 ) / / ’ t i t l e " ’ / / TRIM (
graph_title8 ) // ’" ’
2227 E l s e I f ( P r e s e n t ( y d a t a 7 ) ) Then
2228 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " , "
x y d a t a 1 . d a t " u s i n g 2 : 9 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 7 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 7
) // ’" ’
2229 E l s e I f ( P r e s e n t ( y d a t a 6 ) ) Then
2230 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " , " x y d a t a 1 . d a t "
u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 6 ) / / ’ " ’
2231 E l s e I f ( P r e s e n t ( y d a t a 5 ) ) Then
2232 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s
( 1 ) w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 5 ) / / ’ " ’
2233 E l s e I f ( P r e s e n t ( y d a t a 4 ) ) Then
2234 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 4 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 7 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 9 9 ) / / ’ t i t l e " ’ / / TRIM ( t i t l e ) / / ’ " ’
2235 E l s e I f ( P r e s e n t ( y d a t a 3 ) ) Then
2236 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h
’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 3 ) / / ’ " ’
2237 E l s e I f ( P r e s e n t ( y d a t a 2 ) ) Then
2238 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’
t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 2 ) / / ’ " ’
2239 Else
269

2240 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’


t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 1 ) / / ’ " ’
2241 End I f
2242
2243 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2244
2245 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2246 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2247 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2248 C a l l SYSTEM( ’ g n u p l o t gp2 . t x t ’ )
2249
2250 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2251
2252 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2253 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2254
2255 ! Check m e s s a g e
2256 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2257 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png " i s c r e a t e d . ’
2258
2259 End S u b r o u t i n e
2260
2261 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2262
2263 S u b r o u t i n e f 2 g p D a t a M u l t i ( L o c a t i o n , name , t i t l e , t i t l e 1 , t i t l e 2 , x l a b e l , y l a b e l 1 , y l a b e l 2 , y l a b e l 3 ,
ylabel4 , xdata , ydata01 , g r a p h _ t i t l e 0 1 , style01 , ydata02 , g r a p h _ t i t l e 0 2 , style02 , ydata03 ,
g r a p h _ t i t l e 0 3 , style03 , ydata04 , g r a p h _ t i t l e 0 4 , s t y l e 0 4 )
2264 ! Due t o t h e 2 y a x i s l i m i t m u l t i p l e p l o t s w i t h t h e same x a x i s .
2265 I m p l i c i t None
2266
2267 Character (2) :: style01 , style02 , style03 , style04 , style05 , style06
2268 Integer :: n1 ! number o f d a t a p o i n t s
2269 Character (*) :: xdata ( : ) ! f i r s t x data array
2270 Real :: ydata01 ( : ) , ydata02 ( : ) , ydata03 ( : ) , ydata04 ( : )
2271 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel1 , ylabel2 , ylabel3 , ylabel4
2272 C h a r a c t e r ( l e n =* ) :: t i t l e , t i t l e 1 , t i t l e 2 , name ! p l o t a x i s l a b e l s and t i t l e ( s )
2273 Character (10) :: Location
2274 Integer :: i
2275 Character (*) :: graph_title01 , graph_title02 , graph_title03 , graph_title04
2276 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , L a y o u t 6
2277
2278 n1 = s i z e ( x d a t a )
2279
2280 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2281 ! Write data in f i l e s
2282 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2283 Open ( 1 0 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2284
2285 Do i =1 , n1
2286 W r i t e ( 1 0 , ’ (A, I , 4 ( F ) ) ’ ) x d a t a ( i ) , i , y d a t a 0 1 ( i ) , y d a t a 0 2 ( i ) , y d a t a 0 3 ( i ) , y d a t a 0 4 ( i )
2287 End Do
2288
2289 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
2290
2291 ! C r e a t e g n u p l o t command f i l e
2292 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2293 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2294 Write ( 1 0 , * ) ’ s e t t e r m i n a l p n g c a i r o s i z e 2970 ,2100 ’ ! Sets i t to
c r e a t e . png
2295 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( S h o r t (
L o c a t i o n ) ) / / ’ _ ’ / / t r i m ( Name ) / / ’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t
i n a d i f f e r e n t f o l d e r . The " / " u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2296
2297 Write (10 , * ) ’ s e t m u l t i p l o t title ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e ) / / ’ } " f o n t " , 2 2 " ’
2298
2299 Write (10 , * ) ’ s e t s i z e 1 ,0.5 ’
2300 Write (10 , * ) ’ s e t o r i g i n 0 . 0 , 0 . 0 ’
2301
2302 Write (10 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e 1 / / ’ } " ’ ! Graph T i t l e , t i t l e in
b o l d , works
270 F. Code of the MarsdiepVisual Program

2303 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’


2304 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 2 ) / / ’ " ’
2305 W r i t e ( 1 0 , * ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 1 ) / / ’ " ’
2306
2307 W r i t e ( 1 0 , * ) ’ s e t key L e f t r i g h t b o t t o m i n s i d e o p a q u e ’
2308
2309 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −90 ’
2310 Write (10 , * ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
2311
2312 Write (10 , ’ (A) ’) ’ s e t x2range [ 0 : * ] ’ ! noreverse nowriteback ’
2313 Write (10 , ’ (A) ’) ’ s e t y2range [ 0 : * ] ’ ! noreverse nowriteback ’
2314 Write (10 , ’ (A) ’) ’ unset x2tics ’
2315 Write (10 , ’ (A) ’) ’ set y2tics ’
2316
2317 C a l l GraphStyle ( Style01 , Layout1 )
2318 C a l l GraphStyle ( Style02 , Layout2 )
2319
2320 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ t i t l e " ’
/ / TRIM ( g r a p h _ t i t l e 0 1 ) / / ’ " a x e s x2y2 , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 0 2 ) / / ’ " a x e s x1y1 ’
2321
2322 Write (10 , * ) ’ s e t s i z e 1 ,0.5 ’
2323 Write (10 , * ) ’ s e t o r i g i n 0 . 0 , 0 . 5 ’
2324
2325 Write (10 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t i t l e 2 / / ’ } " ’
2326 Write (10 , * ) ’ unset xlabel ’
2327 Write (10 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 3 ) / / ’ " ’
2328 Write (10 , * ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 4 ) / / ’ " ’
2329 Write (10 , * ) ’ unset xtics ’
2330 Write (10 , * ) ’ set y2tics ’
2331
2332 W r i t e ( 1 0 , * ) ’ s e t key L e f t r i g h t b o t t o m i n s i d e o p a q u e ’
2333
2334 ! W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by − 45 ’
2335 Write (10 , * ) ’ s e t g r i d ’
2336
2337 C a l l GraphStyle ( Style03 , Layout3 )
2338 C a l l GraphStyle ( Style04 , Layout4 )
2339
2340 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 5 w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 0 3 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 2 : 6 w i t h ’ / / t r i m ( L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM (
graph_title04 ) // ’" ’
2341
2342 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2343
2344 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2345 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2346 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2347
2348 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2349
2350 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2351 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2352
2353 ! Check m e s s a g e
2354 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2355 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png " i s c r e a t e d . ’
2356
2357 End S u b r o u t i n e
2358
2359 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2360
2361 S u b r o u t i n e f 2 g p D a t a M u l t i 2 ( name , t i t l e , t i t l e 1 , t i t l e 2 , x l a b e l , y l a b e l 1 , y l a b e l 2 , y l a b e l 3 , y l a b e l 4 ,
xdata1 , xdata2 , ydata11 , ydata12 , g r a p h _ t i t l e 0 1 , style01 , ydata21 , ydata22 , g r a p h _ t i t l e 0 2 , style02
, ydata31 , ydata32 , g r a p h _ t i t l e 0 3 , style03 , ydata41 , ydata42 , g r a p h _ t i t l e 0 4 , style04 , ydata51 ,
ydata52 , g r a p h _ t i t l e 0 5 , style05 , ydata61 , ydata62 , g r a p h _ t i t l e 0 6 , s t y l e 0 6 )
2362 ! Due t o t h e 2 y a x i s l i m i t m u l t i p l e p l o t s w i t h t h e same x a x i s .
2363 I m p l i c i t None
2364
2365 Character (2) :: style01 , style02 , style03 , style04 , style05 , style06
271

2366 Integer :: i , n1 , n2 ! number o f d a t a p o i n t s


2367 Character (*) :: xdata1 ( : ) , xdata2 ( : ) ! f i r s t x data array
2368 Real :: ydata11 ( : ) , ydata12 ( : ) , ydata21 ( : ) , ydata22 ( : ) , ydata31 ( : ) , ydata32 ( : ) ,
ydata41 ( : ) , ydata42 ( : ) , ydata51 ( : ) , ydata52 ( : ) , ydata61 ( : ) , ydata62 ( : )
2369 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel1 , ylabel2 , ylabel3 , ylabel4
2370 C h a r a c t e r ( l e n =* ) :: t i t l e , t i t l e 1 , t i t l e 2 , name ! p l o t a x i s l a b e l s and
title (s)
2371 Character (10) :: Location
2372 Character (*) :: graph_title01 , graph_title02 , graph_title03 , graph_title04 ,
graph_title05 , graph_title06
2373 Character (25) :: Layout1 , Layout2 , Layout3 , Layout4 , Layout5 , L a y o u t 6
2374 Real : : max_d5 , max_d6 , m a x _ t o t
2375
2376 n1 = s i z e ( x d a t a 1 )
2377 n2 = s i z e ( x d a t a 2 )
2378
2379 max_d5 = max ( maxval ( y d a t a 5 1 ) , maxval ( y d a t a 5 2 ) )
2380 max_d6 = max ( maxval ( y d a t a 6 1 ) , maxval ( y d a t a 6 2 ) )
2381 m a x _ t o t = max ( max_d6 , max_d5 )
2382
2383 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2384 ! Write data in f i l e s
2385 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2386 Open ( 1 0 , A c c e s s = ’ S e q u e n t i a l ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2387
2388 Do i = 1 , ( n1+n2 )
2389 I f ( i <= n1 ) Then
2390 I f ( y d a t a 1 1 ( i ) == 0 . o r . y d a t a 2 1 ( i ) == 0 . o r . y d a t a 3 1 ( i ) == 0 . o r . y d a t a 4 1 ( i ) == 0 .
o r . y d a t a 5 1 ( i ) == 0 . o r . y d a t a 6 1 ( i ) == 0 ) Then
2391 Write (10 , * )
2392 Else
2393 W r i t e ( 1 0 , ’ (A, I , 6 ( F ) ) ’ ) x d a t a 1 ( i ) , i , y d a t a 1 1 ( i ) , y d a t a 2 1 ( i ) , y d a t a 3 1 ( i ) , y d a t a 4 1 ( i )
,1 − ( y d a t a 5 1 ( i ) / m a x _ t o t ) ,1 − ( y d a t a 6 1 ( i ) / m a x _ t o t )
2394 End I f
2395 E l s e I f ( i > n1 ) Then
2396 I f ( y d a t a 1 2 ( i − n1 ) == 0 . o r . y d a t a 2 2 ( i − n1 ) == 0 . o r . y d a t a 3 2 ( i − n1 ) == 0 . o r . y d a t a 4 2 ( i
− n1 ) == 0 . o r . y d a t a 5 2 ( i − n1 ) == 0 . o r . y d a t a 6 2 ( i − n1 ) == 0 ) Then
2397 Write (10 , * )
2398 Else
2399 W r i t e ( 1 0 , ’ (A, I , 6 ( F ) ) ’ ) x d a t a 2 ( i − n1 ) , i , y d a t a 1 2 ( i − n1 ) , y d a t a 2 2 ( i − n1 ) , y d a t a 3 2 ( i − n1 ) ,
y d a t a 4 2 ( i − n1 ) ,1 − ( y d a t a 5 2 ( i − n1 ) / m a x _ t o t ) ,1 − ( y d a t a 6 2 ( i − n1 ) / m a x _ t o t )
2400 End I f
2401 End I f
2402 End Do
2403
2404 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
2405
2406 ! C r e a t e g n u p l o t command f i l e
2407 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2408 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2409 Write ( 1 0 , * ) ’ s e t t e r m i n a l p n g c a i r o s i z e 2970 ,2100 ’
2410 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t _ ’ / / t r i m ( Name ) / / ’
. png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2411
2412 Write (10 , * ) ’ s e t m u l t i p l o t title ’ / / ’ " { / : Bold ’ / / t r i m ( t i t l e ) / / ’ } " f o n t " , 2 2 " ’
2413
2414 Write (10 , * ) ’ s e t s i z e 1 ,0.49 ’
2415 Write (10 , * ) ’ s e t o r i g i n 0 . 0 , 0 . 0 ’
2416
2417 Write (10 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e 1 / / ’ } " f o n t " , 2 2 " ’
2418 Write (10 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " f o n t " , 2 2 " o f f s e t 0 , 2 ’
2419 Write (10 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 1 ) / / ’ " f o n t " , 2 2 " ’
2420 Write (10 , * ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 2 ) / / ’ " f o n t " , 2 2 " ’
2421
2422 W r i t e ( 1 0 , * ) ’ s e t key L e f t l e f t t o p o p a q u e box f o n t " , 2 0 " ’
2423
2424 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t l a b e l " T e x e l " a t 3 6 , 1 . 3 5 f o n t " , 2 2 " ’
2425 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t l a b e l " Den H e l d e r " a t 3 9 . 5 , 1 . 3 5 f o n t " , 2 2 " ’
2426
2427 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −90 ’
272 F. Code of the MarsdiepVisual Program

2428
2429 W r i t e ( 1 0 , * ) ’ s e t g r i d n o x t i c s y t i c s lw 2 ’ ! show g r i d l i n e s i n t h e xy p l a n e
2430
2431 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ 0 : 70 ] ’
2432 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x 2 r a n g e [ 0 : * ] ’ ! noreverse nowriteback ’
2433 W r i t e ( 1 0 , ’ (A) ’ ) ’ u n s e t x 2 t i c s ’
2434
2435 Write (10 , ’ (A) ’) ’ set yrange [ 1 : 1 . 4 ] ’
2436 Write (10 , ’ (A) ’) ’ set y t i c s 1 ,0.1 ,1.4 nomirror ’
2437 Write (10 , ’ (A) ’) ’ set y2range [ 0 : 0.2 ] ’
2438 Write (10 , ’ (A) ’) ’ set y2tics 0 ,0.05 ,0.2 nomirror ’
2439
2440 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t l m a r g i n 15 ’
2441 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t r m a r g i n 15 ’
2442
2443 C a l l GraphStyle ( Style01 , Layout1 )
2444 C a l l GraphStyle ( Style02 , Layout2 )
2445
2446 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t a r r o w from 3 8 . 5 , 1 . 0 5 t o 3 8 . 5 , 1 . 4 f i l l e d n o h e a d l s 0 lw 3 ’
2447
2448 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ t i t l e " ’
/ / TRIM ( g r a p h _ t i t l e 0 1 ) / / ’ " a x e s x1y1 , " x y d a t a 1 . d a t " u s i n g 2 : 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 2 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 0 2 ) / / ’ " a x e s x1y2 ’
2449
2450 Write (10 , * ) ’ s e t s i z e 1 ,0.49 ’
2451 Write (10 , * ) ’ s e t o r i g i n 0.0 ,0.49 ’
2452
2453 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / t i t l e 2 / / ’ } " f o n t " , 2 2 " ’
2454 Write (10 , * ) ’ unset x l a b e l ’
2455 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 3 ) / / ’ " f o n t " , 2 2 " ’
2456 W r i t e ( 1 0 , * ) ’ s e t y 2 l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l 4 ) / / ’ " f o n t " , 2 2 " ’
2457 Write (10 , * ) ’ unset x t i c s ’
2458 Write (10 , * ) ’ unset x 2 t i c s ’
2459 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y r a n g e [ 0 : 3 0 ] ’
2460 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y t i c s 0 , 5 , 3 0 n o m i r r o r ’
2461 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y 2 r a n g e [ 0 : 1 . 2 ] ’
2462 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t y 2 t i c s 0 , 0 . 2 , 1 . 2 n o m i r r o r ’
2463
2464 W r i t e ( 1 0 , * ) ’ s e t key L e f t l e f t b o t t o m o p a q u e box f o n t " , 2 0 " ’
2465 W r i t e ( 1 0 , * ) ’ s e t g r i d n o x t i c s y t i c s lw 2 ’
2466
2467 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t x r a n g e [ 0 : 70 ] ’
2468
2469 Call GraphStyle ( Style03 , Layout3 )
2470 Call GraphStyle ( Style04 , Layout4 )
2471 Call GraphStyle ( Style05 , Layout5 )
2472 Call GraphStyle ( Style06 , Layout6 )
2473
2474 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t a r r o w from 3 8 . 5 , 0 t o 3 8 . 5 , 3 0 f i l l e d n o h e a d l s 0 lw 3 ’
2475
2476 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 2 : 5 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 3 ) / / ’ t i t l e " ’
/ / TRIM ( g r a p h _ t i t l e 0 3 ) / / ’ " a x e s x1y1 , " x y d a t a 1 . d a t " u s i n g 2 : 6 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m (
L a y o u t 4 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 0 4 ) / / ’ " a x e s x1y1 , " x y d a t a 1 . d a t " u s i n g 2 : 7 :
x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 5 ) / / ’ t i t l e " ’ / / TRIM ( g r a p h _ t i t l e 0 5 ) / / ’ " a x e s x1y2 , "
x y d a t a 1 . d a t " u s i n g 2 : 8 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 6 ) / / ’ t i t l e " ’ / / TRIM (
g r a p h _ t i t l e 0 6 ) / / ’ " a x e s x1y2 ’
2477
2478 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2479
2480 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2481 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2482 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2483
2484 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2485
2486 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2487 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2488
2489 ! Check m e s s a g e
2490 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
273

2491 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png " i s c r e a t e d . ’


2492
2493 End S u b r o u t i n e
2494
2495 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2496
2497 Subroutine f2gpDataHisto ( t i t l e , xlabel , ylabel , xdata1 , ydata11 , ydata21 , g r a p h _ t i t l e 1 ,
s t y l e 1 , xdata2 , ydata12 , ydata22 , g r a p h _ t i t l e 2 , s t y l e 2 )
2498 ! S u b r o u t i n e f2gpRHData p l o t s t h e r e s u l t s o f t h e v i s c o m e t e r
2499 I m p l i c i t None
2500
2501 Integer :: i
2502 Integer :: n1 , n2
2503 Character (*) :: xdata1 ( : ) , xdata2 ( : )
2504 Real :: ydata11 ( : ) , ydata12 ( : ) , ydata21 ( : ) , ydata22 ( : )
2505 C h a r a c t e r ( l e n =* ) :: xlabel , ylabel , t i t l e ! p l o t a x i s l a b e l s and
title (s)
2506 Character (*) :: graph_title1 , graph_title2
2507 Character (2) :: style1 , style2
2508 Character (25) :: Layout1 , Layout2 , Layout3 , L a y o u t 4
2509
2510 n1 = s i z e ( x d a t a 1 )
2511 n2 = s i z e ( x d a t a 2 )
2512
2513 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2514 ! Write data in f i l e s
2515 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2516 OPEN( 1 0 , A c c e s s = ’SEQUENTIAL ’ , F i l e = ’ x y d a t a 1 . d a t ’ )
2517
2518 W r i t e ( 1 0 , ’ (A) ’ ) ’ Sample_Code i Bingham H e r s c h e l − B u l k l e y ’
2519
2520 Do i = 1 , ( n1+n2 )
2521 I f ( i <= n1 ) Then
2522 I f ( y d a t a 1 1 ( i ) == 0 . o r . y d a t a 2 1 ( i ) == 0 ) Then
2523 ! Write (10 , * )
2524 Else
2525 W r i t e ( 1 0 , ’ (A, I , 2 ( F ) ) ’ ) x d a t a 1 ( i ) , i , y d a t a 1 1 ( i ) , y d a t a 2 1 ( i )
2526 End I f
2527 E l s e I f ( i > n1 ) Then
2528 I f ( y d a t a 1 2 ( i − n1 ) == 0 . o r . y d a t a 2 2 ( i − n1 ) == 0 ) Then
2529 ! Write (10 , * )
2530 Else
2531 W r i t e ( 1 0 , ’ (A, I , 6 ( F ) ) ’ ) x d a t a 2 ( i − n1 ) , i , y d a t a 1 2 ( i − n1 ) , y d a t a 2 2 ( i − n1 )
2532 End I f
2533 End I f
2534 End Do
2535
2536 CLOSE ( 1 0 , S t a t u s = ’KEEP ’ )
2537
2538 ! C r e a t e g n u p l o t command f i l e
2539 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2540 OPEN( 1 0 , ACCESS= ’SEQUENTIAL ’ , FILE= ’ gp . t x t ’ )
2541 Write (10 , * ) ’ s e t t e r m i n a l p n g c a i r o s i z e 2400 ,800 ’ ! Sets i t to
c r e a t e . png
2542 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t o u t p u t ’ / / ’ " ’ / / ’D : / h i j n e k a m / D e s k t o p / Program / G r a p h s / P l o t ’ / / t r i m ( t i t l e ) / /
’ . png ’ / / ’ " ’ ! C r e a t e s . png f i l e and s t o r e s i t i n a d i f f e r e n t f o l d e r . The " / "
u s e d i s d i f f e r e n t from t h e d e f a u l t o r f o r t r a n ( " \ " ) ! ! !
2543 W r i t e ( 1 0 , * ) ’ s e t t i t l e ’ / / ’ " { / : Bold ’ / / T i t l e / / ’ } " ’ ! Graph T i t l e , t i t l e i n
b o l d , works
2544 W r i t e ( 1 0 , * ) ’ s e t x l a b e l ’ / / ’ " ’ / / Trim ( x l a b e l ) / / ’ " ’
2545 W r i t e ( 1 0 , * ) ’ s e t y l a b e l ’ / / ’ " ’ / / Trim ( y l a b e l ) / / ’ " ’
2546
2547 W r i t e ( 1 0 , * ) ’ s e t key L e f t r i g h t i n s i d e ’
2548 W r i t e ( 1 0 , * ) ’ s e t x t i c s r o t a t e by −45 ’
2549 Write (10 , * ) ’ s e t g r i d ’ ! show g r i d l i n e s i n t h e xy p l a n e
2550
2551 Write (10 , * ) ’ s e t boxwidth 0.5 ’
2552
2553 C a l l GraphStyle ( Style1 , Layout1 )
2554 C a l l GraphStyle ( Style2 , Layout2 )
2555
274 F. Code of the MarsdiepVisual Program

2556 W r i t e ( 1 0 , ’ (A) ’ ) ’ p l o t " x y d a t a 1 . d a t " u s i n g 3 : x t i c l a b e l s ( 1 ) w i t h ’ / / t r i m ( L a y o u t 1 ) / / ’ t i t l e " ’ / /


TRIM ( g r a p h _ t i t l e 1 ) / / ’ " , " x y d a t a 1 . d a t " u s i n g 4 : x t i c l a b e l s ( 1 ) w i t h ’ / / L a y o u t 2 / / ’ t i t l e " ’ / /
TRIM ( g r a p h _ t i t l e 2 ) / / ’ " ’
2557
2558 CLOSE ( 1 0 , STATUS= ’KEEP ’ )
2559
2560 ! P l o t c u r v e w i t h g n u p l o t and c l e a n u p f i l e s
2561 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2562 C a l l SYSTEM( ’ g n u p l o t gp . t x t ’ )
2563
2564 ! Pause ! To c h e c k t h e gnu f i l e b e f o r e d e l e t i o n i f t h e g r a p h i s n o t a s e x p e c t e d
.
2565
2566 C a l l SYSTEM( ’ d e l gp . t x t ’ )
2567 C a l l SYSTEM( ’ d e l x y d a t a 1 . d a t ’ )
2568
2569 ! Check m e s s a g e
2570 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2571 W r i t e ( * , ’ (A) ’ ) ’ F i l e " P l o t ’ / / t r i m ( T i t l e ) / / ’ . png " i s c r e a t e d . ’
2572
2573 End S u b r o u t i n e
2574
2575 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
2576
2577 S u b r o u t i n e G r a p h S t y l e ( S t y l e , Layout , I n d e x )
2578 ! I n o r d e r t o c r e a t e u n i f o r m i t y i n t h e o u t p u t , t h i s i s s e p a r a t e d from t h e p l o t s u b r o u t i n e s
s o i t c a n be u s e d by a l l o f t h o s e .
2579 I m p l i c i t None
2580
2581 Character (2) :: style
2582 Character (25) :: Layout
2583 Integer , Optional : : Index
2584
2585 S e l e c t Case ( s t y l e )
2586 Case ( ’ 1 a ’ )
2587 Layout = ’ l i n e s l s 1 ’
2588 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2589 I f ( P r e s e n t ( I n d e x ) ) Then
2590 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2591 Else
2592 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2593 End I f
2594
2595 Case ( ’ 1 b ’ )
2596 Layout = ’ l i n e s l s 2 ’
2597 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2598 I f ( P r e s e n t ( I n d e x ) ) Then
2599 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1

2600 Else
2601 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1 ’
2602 End I f
2603
2604 Case ( ’ 1 c ’ )
2605 Layout = ’ l i n e s l s 3 ’
2606 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2607 I f ( P r e s e n t ( I n d e x ) ) Then
2608 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2609 Else
2610 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2611 End I f
2612
2613 Case ( ’ 1 d ’ )
2614 Layout = ’ l i n e s l s 4 ’
2615 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2616 I f ( P r e s e n t ( I n d e x ) ) Then
2617 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s
1’
2618 Else
2619 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2620 End I f
275

2621
2622 Case ( ’ 1 e ’ )
2623 Layout = ’ l i n e s l s 5 ’
2624 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2625 I f ( P r e s e n t ( I n d e x ) ) Then
2626 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " m a g e n t a " l t 1 lw 2 p t 7 p s 1 ’
2627 Else
2628 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " m a g e n t a " l t 1 lw 2 p t 7 p s 1 ’
2629 End I f
2630
2631 Case ( ’ 1 f ’ )
2632 Layout = ’ l i n e s l s 6 ’
2633 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2634 I f ( P r e s e n t ( I n d e x ) ) Then
2635 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s a n d y b r o w n " l t 1 lw 2 p t 7 p s
1’
2636 Else
2637 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " s a n d y b r o w n " l t 1 lw 2 p t 7 p s 1 ’
2638 End I f
2639
2640 Case ( ’ 1 g ’ )
2641 Layout = ’ l i n e s l s 7 ’
2642 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2643 I f ( P r e s e n t ( I n d e x ) ) Then
2644 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s
1’
2645 Else
2646 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s 1 ’
2647 End I f
2648
2649 Case ( ’ 1 h ’ )
2650 Layout = ’ l i n e s l s 8 ’
2651 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2652 I f ( P r e s e n t ( I n d e x ) ) Then
2653 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s p r i n g − g r e e n " l t 1 lw 2 p t 7
ps 1 ’
2654 Else
2655 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " s p r i n g − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2656 End I f
2657
2658 Case ( ’ 1 i ’ )
2659 Layout = ’ l i n e s l s 9 ’
2660 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2661 I f ( P r e s e n t ( I n d e x ) ) Then
2662 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " c y a n " l t 1 lw 2 p t 7 p s 1 ’
2663 Else
2664 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " c y a n " l t 1 lw 2 p t 7 p s 1 ’
2665 End I f
2666
2667 Case ( ’ 1 j ’ )
2668 L a y o u t = ’ l i n e s l s 10 ’
2669 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2670 I f ( P r e s e n t ( I n d e x ) ) Then
2671 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " k h a k i " l t 1 lw 2 p t 7 p s 1 ’
2672 Else
2673 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " k h a k i " l t 1 lw 2 p t 7 p s 1 ’
2674 End I f
2675
2676 Case ( ’ 1 k ’ ) ! Redish
2677 L a y o u t = ’ l i n e s l s 11 ’
2678 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2679 I f ( P r e s e n t ( I n d e x ) ) Then
2680 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 3 p t 7 p s 1

2681 Else
2682 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b ’ ’ # d d 1 8 1 f ’ ’ l t 1 lw 3 p t 7 p s 1 ’
2683 End I f
2684
2685 Case ( ’ 1 l ’ )
2686 L a y o u t = ’ l i n e s l s 12 ’
2687 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
276 F. Code of the MarsdiepVisual Program

2688 I f ( P r e s e n t ( I n d e x ) ) Then
2689 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 1

2690 Else
2691 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 1 ’
2692 End I f
2693
2694 Case ( ’ 1m’ )
2695 L a y o u t = ’ l i n e s l s 13 ’
2696 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2697 I f ( P r e s e n t ( I n d e x ) ) Then
2698 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2699 Else
2700 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2701 End I f
2702
2703 Case ( ’ 1 n ’ )
2704 L a y o u t = ’ l i n e s l s 14 ’
2705 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2706 I f ( P r e s e n t ( I n d e x ) ) Then
2707 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 7 p s
1’
2708 Else
2709 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 14 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 7 p s 1 ’
2710 End I f
2711
2712 Case ( ’ 1 o ’ )
2713 L a y o u t = ’ l i n e s l s 15 ’
2714 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2715 I f ( P r e s e n t ( I n d e x ) ) Then
2716 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " m a g e n t a " l t 1 lw 3 p t 7 p s 1 ’
2717 Else
2718 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 15 l c r g b " m a g e n t a " l t 1 lw 3 p t 7 p s 1 ’
2719 End I f
2720
2721 Case ( ’ 1 p ’ )
2722 L a y o u t = ’ l i n e s l s 16 ’
2723 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2724 I f ( P r e s e n t ( I n d e x ) ) Then
2725 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s a n d y b r o w n " l t 1 lw 3 p t 7 p s
1’
2726 Else
2727 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 16 l c r g b " s a n d y b r o w n " l t 1 lw 3 p t 7 p s 1 ’
2728 End I f
2729
2730 Case ( ’ 1 q ’ )
2731 L a y o u t = ’ l i n e s l s 17 ’
2732 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2733
2734 I f ( P r e s e n t ( I n d e x ) ) Then
2735 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " o r a n g e − r e d " l t 1 lw 3 p t 7 p s
1’
2736 Else
2737 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 17 l c r g b " o r a n g e − r e d " l t 1 lw 3 p t 7 p s 1 ’
2738 End I f
2739
2740 Case ( ’ 1 r ’ )
2741 L a y o u t = ’ l i n e s l s 18 ’
2742 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2743 I f ( P r e s e n t ( I n d e x ) ) Then
2744 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " s p r i n g − g r e e n " l t 1 lw 3 p t 7
ps 1 ’
2745 Else
2746 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 18 l c r g b " s p r i n g − g r e e n " l t 1 lw 3 p t 7 p s 1 ’
2747 End I f
2748
2749 Case ( ’ 1 s ’ )
2750 L a y o u t = ’ l i n e s l s 19 ’
2751 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2752 I f ( P r e s e n t ( I n d e x ) ) Then
2753 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " c y a n " l t 1 lw 3 p t 7 p s 1 ’
277

2754 Else
2755 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 19 l c r g b " c y a n " l t 1 lw 3 p t 7 p s 1 ’
2756 End I f
2757
2758 Case ( ’ 1 t ’ )
2759 L a y o u t = ’ l i n e s l s 20 ’
2760 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2761 I f ( P r e s e n t ( I n d e x ) ) Then
2762 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " k h a k i " l t 1 lw 3 p t 7 p s 1 ’
2763 Else
2764 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 20 l c r g b " k h a k i " l t 1 lw 3 p t 7 p s 1 ’
2765 End I f
2766
2767 Case ( ’ 1 u ’ )
2768 L a y o u t = ’ l i n e s l s 21 ’
2769 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2770 I f ( P r e s e n t ( I n d e x ) ) Then
2771 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " b i s q u e " l t 1 lw 3 p t 7 p s 1 ’
2772 Else
2773 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 21 l c r g b " b i s q u e " l t 1 lw 3 p t 7 p s 1 ’
2774 End I f
2775
2776 Case ( ’ 1 v ’ )
2777 L a y o u t = ’ l i n e s l s 22 ’
2778 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2779 I f ( P r e s e n t ( I n d e x ) ) Then
2780 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " plum " l t 1 lw 3 p t 7 p s 1 ’
2781 Else
2782 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 22 l c r g b " plum " l t 1 lw 3 p t 7 p s 1 ’
2783 End I f
2784
2785 Case ( ’ 1w ’ )
2786 L a y o u t = ’ l i n e s l s 23 ’
2787 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2788 I f ( P r e s e n t ( I n d e x ) ) Then
2789 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " medium − b l u e " l t 1 lw 3 p t 7 p s
1’
2790 Else
2791 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 23 l c r g b " medium − b l u e " l t 1 lw 3 p t 7 p s 1 ’
2792 End I f
2793
2794 Case ( ’ 1 x ’ )
2795 L a y o u t = ’ l i n e s l s 24 ’
2796 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2797 I f ( P r e s e n t ( I n d e x ) ) Then
2798 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − o r a n g e " l t 1 lw 3 p t 7 p s
1’
2799 Else
2800 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 24 l c r g b " d a r k − o r a n g e " l t 1 lw 3 p t 7 p s 1 ’
2801 End I f
2802
2803 Case ( ’ 1 y ’ )
2804 L a y o u t = ’ l i n e s l s 25 ’
2805 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2806 I f ( P r e s e n t ( I n d e x ) ) Then
2807 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − plum " l t 1 lw 3 p t 7 p s 1

2808 Else
2809 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 25 l c r g b " d a r k − plum " l t 1 lw 3 p t 7 p s 1 ’
2810 End I f
2811
2812 Case ( ’ 1 z ’ )
2813 L a y o u t = ’ l i n e s l s 26 ’
2814 I f ( P r e s e n t ( I n d e x ) ) W r i t e ( Layout , ’ (A, I 2 ) ’ ) ’ l i n e s l s ’ , I n d e x
2815 I f ( P r e s e n t ( I n d e x ) ) Then
2816 W r i t e ( 1 0 , ’ (A, I2 , A) ’ ) ’ s e t s t y l e l i n e ’ , I n d e x , ’ l c r g b " d a r k − g o l d e n r o d " l t 1 lw 3 p t 7
ps 1 ’
2817 Else
2818 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 26 l c r g b " d a r k − g o l d e n r o d " l t 1 lw 3 p t 7 p s 1 ’
2819 End I f
2820
278 F. Code of the MarsdiepVisual Program

2821
2822 Case ( ’ 2 a ’ )
2823 Layout = ’ lp l s 1 ’
2824 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 2 p t 7 p s 1 ’
2825
2826 Case ( ’ 2 b ’ )
2827 Layout = ’ lp l s 2 ’
2828 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 2 p t 7 p s 1 ’
2829
2830 Case ( ’ 2 c ’ )
2831 Layout = ’ lp l s 3 ’
2832 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2833
2834 Case ( ’ 2 d ’ )
2835 Layout = ’ lp l s 4 ’
2836 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 7 p s 2 ’
2837
2838 Case ( ’ 2 e ’ )
2839 Layout = ’ lp l s 5 ’
2840 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " d a r k − r e d " l t 1 lw 2 p t 7 p s 1 ’
2841
2842 Case ( ’ 2 f ’ )
2843 Layout = ’ lp l s 6 ’
2844 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " o r a n g e − r e d " l t 1 lw 2 p t 7 p s 1 ’
2845
2846 Case ( ’ 2 g ’ )
2847 Layout = ’ lp l s 7 ’
2848 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " t a n 1 " l t 1 lw 2 p t 7 p s 1 ’
2849
2850 Case ( ’ 2 h ’ )
2851 Layout = ’ lp l s 8 ’
2852 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " d a r k − g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2853
2854 Case ( ’ 2 i ’ )
2855 Layout = ’ lp l s 9 ’
2856 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " g r e e n " l t 1 lw 2 p t 7 p s 1 ’
2857
2858 Case ( ’ 2 j ’ )
2859 L a y o u t = ’ l p l s 10 ’
2860 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " c h a r t r e u s e " l t 1 lw 2 p t 7 p s 1 ’
2861
2862 Case ( ’ 2 k ’ )
2863 L a y o u t = ’ l p l s 11 ’
2864 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b " d a r k − g o l d e n r o d " l t 1 lw 2 p t 7 p s 1 ’
2865
2866 Case ( ’ 2 l ’ )
2867 L a y o u t = ’ l p l s 12 ’
2868 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " o r a n g e " l t 1 lw 2 p t 7 p s 1 ’
2869
2870 Case ( ’ 2m’ )
2871 L a y o u t = ’ l p l s 13 ’
2872 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " g o l d " l t 1 lw 2 p t 7 p s 1 ’
2873
2874 Case ( ’ 2 n ’ )
2875 L a y o u t = ’ l p l s 13 ’
2876 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 7 p s 2 ’
2877
2878 Case ( ’ 2 o ’ )
2879 L a y o u t = ’ l p l s 12 ’
2880 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " web− g r e e n " l t 1 lw 1 p t 7 p s 2 ’
2881
2882
2883 Case ( ’ 3 a ’ )
2884 Layout = ’ p o i n t s l s 1 ’
2885 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " r e d " l t 1 lw 3 p t 6 p s 2 ’
2886
2887 Case ( ’ 3 b ’ )
2888 Layout = ’ p o i n t s l s 2 ’
2889 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " d a r k − b l u e " l t 1 lw 3 p t 6 p s 2 ’
2890
2891 Case ( ’ 3 c ’ )
279

2892 Layout = ’ p o i n t s l s 3 ’
2893 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " o r a n g e " l t 1 lw 3 p t 6 p s 2 ’
2894
2895 Case ( ’ 3 d ’ )
2896 Layout = ’ p o i n t s l s 4 ’
2897 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " d a r k − g r e e n " l t 1 lw 1 p t 6 p s 2 ’
2898
2899 Case ( ’ 3 e ’ )
2900 Layout = ’ p o i n t s l s 5 ’
2901 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " m a g e n t a " l t 1 lw 1 p t 6 p s 2 ’
2902
2903 Case ( ’ 3 f ’ )
2904 Layout = ’ p o i n t s l s 6 ’
2905 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b " s a n d y b r o w n " l t 1 lw 1 p t 6 p s 2 ’
2906
2907 Case ( ’ 3 g ’ )
2908 Layout = ’ p o i n t s l s 7 ’
2909 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 6 p s 2 ’
2910
2911 Case ( ’ 3 h ’ )
2912 Layout = ’ p o i n t s l s 8 ’
2913 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " s p r i n g − g r e e n " l t 1 lw 1 p t 6 p s 2 ’
2914
2915 Case ( ’ 3 i ’ )
2916 Layout = ’ p o i n t s l s 9 ’
2917 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 9 l c r g b " c y a n " l t 1 lw 1 p t 6 p s 2 ’
2918
2919 Case ( ’ 3 j ’ )
2920 L a y o u t = ’ p o i n t s l s 10 ’
2921 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 10 l c r g b " k h a k i " l t 1 lw 1 p t 6 p s 2 ’
2922
2923 Case ( ’ 3 k ’ )
2924 L a y o u t = ’ p o i n t s l s 11 ’
2925 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 11 l c r g b " r e d " l t 1 lw 1 p t 6 p s 2 ’
2926
2927 Case ( ’ 3 l ’ )
2928 L a y o u t = ’ p o i n t s l s 12 ’
2929 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 12 l c r g b " d a r k − b l u e " l t 1 lw 1 p t 6 p s 2 ’
2930
2931 Case ( ’ 3m’ )
2932 L a y o u t = ’ p o i n t s l s 13 ’
2933 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 13 l c r g b " r e d " l t 1 lw 1 p t 7 p s 3 ’
2934
2935 Case ( ’ 3 n ’ )
2936 L a y o u t = ’ p o i n t s l s 14 ’
2937 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 14 l c r g b " d a r k − b l u e " l t 1 lw 1 p t 7 p s 3 ’
2938
2939 Case ( ’ 3 o ’ )
2940 L a y o u t = ’ p o i n t s l s 15 ’
2941 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 15 l c r g b " c h a r t r e u s e " l t 1 lw 1 p t 7 p s 3 ’
2942
2943 Case ( ’ 3 p ’ )
2944 L a y o u t = ’ p o i n t s l s 16 ’
2945 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 16 l c r g b " d a r k − g r e e n " l t 1 lw 1 p t 7 p s 3 ’
2946
2947 Case ( ’ 3 q ’ )
2948 L a y o u t = ’ p o i n t s l s 17 ’
2949 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 17 l c r g b " m a g e n t a " l t 1 lw 1 p t 7 p s 3 ’
2950
2951 Case ( ’ 3 r ’ )
2952 L a y o u t = ’ p o i n t s l s 18 ’
2953 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 18 l c r g b " s a n d y b r o w n " l t 1 lw 1 p t 7 p s 3 ’
2954
2955 Case ( ’ 3 s ’ )
2956 L a y o u t = ’ p o i n t s l s 19 ’
2957 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 19 l c r g b " c y a n " l t 1 lw 1 p t 7 p s 3 ’
2958
2959 Case ( ’ 3 t ’ )
2960 L a y o u t = ’ p o i n t s l s 20 ’
2961 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 20 l c r g b " o r a n g e " l t 1 lw 1 p t 7 p s 3 ’
2962
280 F. Code of the MarsdiepVisual Program

2963 Case ( ’ 3 u ’ )
2964 L a y o u t = ’ p o i n t s l s 21 ’
2965 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 21 l c r g b " d a r k − v i o l e t " l t 1 lw 1 p t 7 p s 3 ’
2966
2967 Case ( ’ 3 v ’ )
2968 L a y o u t = ’ p o i n t s l s 22 ’
2969 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 22 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 6 p s 2 ’
2970
2971 Case ( ’ 3w ’ )
2972 L a y o u t = ’ p o i n t s l s 23 ’
2973 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 23 l c r g b " o r a n g e − r e d " l t 1 lw 1 p t 7 p s 3 ’
2974
2975 Case ( ’ 3 x ’ )
2976 L a y o u t = ’ p o i n t s l s 24 ’
2977 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 24 l c r g b " c h a r t r e u s e " l t 1 lw 3 p t 6 p s 2 ’
2978
2979 Case ( ’ 3 y ’ )
2980 L a y o u t = ’ p o i n t s l s 25 ’
2981 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 25 l c r g b " d a r k − r e d " l t 1 lw 3 p t 6 p s 2 ’
2982
2983 Case ( ’ 3 z ’ )
2984 L a y o u t = ’ p o i n t s l s 26 ’
2985 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 26 l c r g b " d a r k − g r e e n " l t 1 lw 3 p t 6 p s 2 ’
2986
2987
2988 Case ( ’ 4 a ’ )
2989 Layout = ’ c i r c l e s l s 1 ’
2990 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 1 l c r g b " g r a y " lw 3 ’
2991
2992 Case ( ’ 4 b ’ )
2993 Layout = ’ c i r c l e s l s 2 ’
2994 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 2 l c r g b " r e d " lw 3 ’
2995
2996 Case ( ’ 4 c ’ )
2997 Layout = ’ c i r c l e s l s 3 ’
2998 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 3 l c r g b " l i g h t − g r e e n " lw 3 ’
2999
3000 Case ( ’ 4 d ’ )
3001 Layout = ’ c i r c l e s l s 4 ’
3002 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 4 l c r g b " p i n k " lw 3 ’
3003
3004 Case ( ’ 4 e ’ )
3005 Layout = ’ c i r c l e s l s 5 ’
3006 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 5 l c r g b " d a r k − g r a y " lw 3 ’
3007
3008 Case ( ’ 4 f ’ )
3009 Layout = ’ c i r c l e s l s 6 ’
3010 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 6 l c r g b "# d a r k − b l u e " lw 3 ’
3011
3012 Case ( ’ 4 g ’ )
3013 Layout = ’ c i r c l e s l s 7 ’
3014 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 7 l c r g b " d a r k − y e l l o w " lw 3 ’
3015
3016 Case ( ’ 4 h ’ )
3017 Layout = ’ c i r c l e s l s 8 ’
3018 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e 8 l c r g b " o r a n g e " lw 3 ’
3019
3020
3021 Case ( ’ 5 a ’ )
3022 Layout = ’ boxes l s 1 ’
3023 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e s 1 l c r g b " r e d " lw 3 ’
3024
3025 Case ( ’ 5 b ’ )
3026 Layout = ’ boxes l s 2 ’
3027 W r i t e ( 1 0 , ’ (A) ’ ) ’ s e t s t y l e l i n e s 2 l c r g b " d a r k − b l u e " lw 3 ’
3028
3029
3030 Case D e f a u l t
3031 W r i t e ( * , ’ (A) ’ ) " Graph S t y l e unknown , p r o c e s s a b o r t e d . "
3032 Return
3033
281

3034 End S e l e c t
3035
3036 End S u b r o u t i n e
3037
3038 ! −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
3039
3040 End Module V i s u a l M o d u l e

Code/VisualModule.f90

You might also like