1.3 Modelling with FORTRAN 95
5
∂
2 f
∂ x 2 ≈
f (x + Δx) − 2 f (x) + f (x − Δx)
(Δx) 2
=
f k+1 − 2 f k + f k−1
(Δx) 2
A certain truncation error is made when using these approximations. Higherorder finite-difference schemes, not detailed in this book, can be used to reduce the
truncation error.
1.2.2 Requirements for a Finite-Difference Model
A finite-difference model needs to satisfy the four requirements:
• Consistency
• Accuracy
• Numerical stability
• Efficiency
The first requirement is that the finite-difference equations have to be consistent
with the differential equations describing a physical process. The second requirement is that the model prediction should be as accurate as possible; that is, truncation
errors and round-off errors should be kept as small as possible. The third requirement is that the prediction has to be numerically stable. Certain stability criteria
need to be satisfied in order to achieve this. The forth requirement is that a model
simulation should be as efficient as possible in terms of total simulation time and
the amount of data produced.
1.3 Modelling with FORTRAN 95
1.3.1 Writing and Compiling Codes
FORTRAN 95 is used as programming language to calculate the evolution of a
dynamical process being described by a set of finite-difference equations. FORTRAN codes are written as text documents saved with the file extension “.f95” for
later identification. Using the open-source “G95” FORTRAN compiler, these files
are converted into an executable file by entering:
g95 file.f95
in the Command Prompt window. On Microsoft Windows operation systems, the
Command Prompt window is found under Start/All Programs/Accessories. The G95
FORTRAN compiler is available for many different computer platforms and can be
downloaded from:
http://www.g95.org
Précédent

- 19/193

Suivant