Geoscienze-Modelli Numerici. Introduzione

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Numerical Modelling in

Geosciences
Lecture 1
Introduction and basic
mathematics for PDEs
Useful information
Slides and exercises: download at my homepage:
http://www.geoscienze.unipd.it/users/faccenda-manuele

Textbooks:
• Gerya, T. Introduction to numerical geodynamic modelling.
Cambridge University Press, 345 pp. (2010).

• Turcotte, D.L., Schubert, G. Geodynamics.


Cambridge University Press, 456 pp., 2nd edition (2002).

Any trouble?: just ask + Thursday 11:00-13:00 (???)

Final exam: oral discussion about:


• the physics behind geological/geodynamical processes.
• used numerical techniques.
• the thermo-mechanical code the student will program through the course.
Why numerical modelling in geosciences?
1. Most of the geological processes occur at timescales and depths such that they cannot
be observed directly.

Max. human timescale


Accessible by drilling
(max 10 km)
Unaccessible
Why numerical modelling in geosciences?
2. Direct measurements of, for example, stress, deformation (strain rate), composition,
temperature, pressure, etc., are limited to few rock samples. With numerical models we
can know their distribution everywhere in our computational domain.
Why numerical modelling in geosciences?
3. Numerical modelling is an indispensable tool to understand the evolution of complex
geological systems together with laboratory experiments (input) and field and geophysical
observations (output).
Field  and  geophysical  data  

Analogue/numerical  modeling   Lab.  analysis/experiments  and  


theory  
Understanding
geological
processes
What is numerical modelling in geosciences?
Fundamental PDEs in this course Discretization: FD,FE,FV
Eulerian+Lagrangian meshes

 Conservation of mass for


∇⋅v = 0 incompressible media

 Conservation of momentum for


∇ ⋅ σ # − ∇P = −ρ g slowly flowing continuous media

DT  Conservation of energy
ρc P = −∇ ⋅ q + H
Dt

To close the system we need rock physical properties from lab. experiments:

• density
• thermal conductivity, expansivity
• heat capacity
• rock mechanical properties
• melting/metamorphic reactions
2D mechanical models
Boudinage Buckling/folding
3D petrological-thermo-
mechanical models

3D subduction + patterns of deformation


Visualization is important!

Sibylla von Cleve als Braut, Noble dame, 1959


Lukas Cranach d. Ä. (1472-1553) © Succession Picasso / VG Bild-Kunst, Bonn 2001
4.00E+03 9.00E+03 0.00E+00 1.10E-09 -2.09E-09 0 134 1095 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
5.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.89E-09 0 165 1126 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
6.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.69E-09 0 196 1157 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
7.00E+03 Numerical modeling without visualization
9.00E+03 0.00E+00 1.10E-09 -1.49E-09 0 227 1188 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
8.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.29E-09 0 258 1219 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
9.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.10E-09 0 289 1250 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
1.00E+04 9.00E+03 0.00E+00 1.10E-09 -8.96E-10 0 320 1281 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
1.10E+04 9.00E+03 0.00E+00 1.10E-09 -6.97E-10 0 351 1312 1.00E+19 3.00E-05 3.15E+02 0.00E+00 1.00E+03
1.20E+04 9.00E+03 0.00E+00 1.10E-09 -4.98E-10 0 382 1343 1.00E+19 3.01E-05 3.81E+02 0.00E+00 1.00E+03
1.30E+04 9.00E+03 0.00E+00 1.10E-09 -2.99E-10 0 413 1374 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.40E+04 9.00E+03 0.00E+00 1.10E-09 -9.96E-11 0 444 1405 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.50E+04 9.00E+03 0.00E+00 1.10E-09 9.96E-11 0 475 1436 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.60E+04 9.00E+03 0.00E+00 1.10E-09 2.99E-10 0 506 1467 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.70E+04 9.00E+03 0.00E+00 1.10E-09 4.98E-10 0 537 1498 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.80E+04 9.00E+03 0.00E+00 1.10E-09 6.97E-10 0 568 1529 1.00E+19 3.01E-05 3.81E+02 0.00E+00 1.00E+03
1.90E+04 9.00E+03 0.00E+00 1.10E-09 8.96E-10 0 599 1560 1.00E+19 3.00E-05 3.15E+02 0.00E+00 1.00E+03
2.00E+04 9.00E+03 0.00E+00 1.10E-09 1.10E-09 0 630 1591 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.10E+04 9.00E+03 0.00E+00 1.10E-09 1.29E-09 0 661 1622 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.20E+04 9.00E+03 0.00E+00 1.10E-09 1.49E-09 0 692 1653 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.30E+04 9.00E+03 0.00E+00 1.10E-09 1.69E-09 0 723 1684 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.40E+04 9.00E+03 0.00E+00 1.10E-09 1.89E-09 0 754 1715 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.50E+04 9.00E+03 0.00E+00 1.10E-09 2.09E-09 0 785 1746 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.60E+04 9.00E+03 0.00E+00 1.10E-09 2.29E-09 0 816 1777 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.70E+04 9.00E+03 0.00E+00 1.10E-09 2.49E-09 0 847 1808 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.80E+04 9.00E+03 0.00E+00 1.10E-09 2.69E-09 0 878 1839 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.90E+04 9.00E+03 0.00E+00 1.10E-09 2.89E-09 0 909 1870 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
3.00E+04 9.00E+03 0.00E+00 1.10E-09 0.00E+00 0 940 1901 1.00E+19 3.00E-05 2.98E+02 2.02E+03 1.00E+03
0.00E+00 9.00E+03 0.00E+00 1.10E-09 -2.89E-09 0 10 971 1.00E+19 3.00E-05 2.98E+02 1.99E+03 1.00E+03
1.00E+03 9.00E+03 0.00E+00 1.10E-09 -2.69E-09 0 41 1002 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.00E+03 9.00E+03 0.00E+00 1.10E-09 -2.49E-09 0 72 1033 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
3.00E+03 9.00E+03 0.00E+00 1.10E-09 -2.29E-09 0 103 1064 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
4.00E+03 9.00E+03 0.00E+00 1.10E-09 -2.09E-09 0 134 1095 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
5.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.89E-09 0 165 1126 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
6.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.69E-09 0 196 1157 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
7.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.49E-09 0 227 1188 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
8.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.29E-09 0 258 1219 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
9.00E+03 9.00E+03 0.00E+00 1.10E-09 -1.10E-09 0 289 1250 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
1.00E+04 9.00E+03 0.00E+00 1.10E-09 -8.96E-10 0 320 1281 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
1.10E+04 9.00E+03 0.00E+00 1.10E-09 -6.97E-10 0 351 1312 1.00E+19 3.00E-05 3.15E+02 0.00E+00 1.00E+03
1.20E+04 9.00E+03 0.00E+00 1.10E-09 -4.98E-10 0 382 1343 1.00E+19 3.01E-05 3.81E+02 0.00E+00 1.00E+03
1.30E+04 9.00E+03 0.00E+00 1.10E-09 -2.99E-10 0 413 1374 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.40E+04 9.00E+03 0.00E+00 1.10E-09 -9.96E-11 0 444 1405 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.50E+04 9.00E+03 0.00E+00 1.10E-09 9.96E-11 0 475 1436 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.60E+04 9.00E+03 0.00E+00 1.10E-09 2.99E-10 0 506 1467 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.70E+04 9.00E+03 0.00E+00 1.10E-09 4.98E-10 0 537 1498 1.00E+19 3.01E-05 3.98E+02 0.00E+00 1.00E+03
1.80E+04 9.00E+03 0.00E+00 1.10E-09 6.97E-10 0 568 1529 1.00E+19 3.01E-05 3.81E+02 0.00E+00 1.00E+03
1.90E+04 9.00E+03 0.00E+00 1.10E-09 8.96E-10 0 599 1560 1.00E+19 3.00E-05 3.15E+02 0.00E+00 1.00E+03
2.00E+04 9.00E+03 0.00E+00 1.10E-09 1.10E-09 0 630 1591 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.10E+04 9.00E+03 0.00E+00 1.10E-09 1.29E-09 0 661 1622 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
2.20E+04 9.00E+03 0.00E+00 1.10E-09 1.49E-09 0 692 1653 1.00E+19 3.00E-05 2.98E+02 0.00E+00 1.00E+03
Numerical modeling with visualization

400oC
800oC
1200o C

Temperature

Viscosity 200oC
400oC

600oC

800oC

1000o C
1200o C

Bulk Strain
Computational resources
1D/2D models:
• computation and visualization can be mostly done on local
machines with moderate to high RAM and 1 to 8 CPUs
(depending on the numerical resolution = problem size)(€
1.500-4.000)
Workstation

3D models:
• computation on supercomputing clusters (e.g., PLX, EURORA
and FERMI at CINECA, Italy) with 100s to 1.000.000s CPUs. If
many users, “problems” may arise due to long queuing times.
• alternatively, with about € 100.000 it is possible to buy medium
size clusters (e.g., 384-786 CPUs) that could serve the whole FERMI at CINECA, Bologna,
Italy
department.
• visualization requires powerful GPUs (€ 2.000-10.0000) and can
be done on local machines or remotely using cluster’s GPUs.

Programming languages:
C/C++, Fortran, MatLab (€ 500-1000 à Octave for free!)

Visualization softwares:
MatLab, Paraview, Amira, etc.

This is not a coffee vending


machine!
…end of the introduction…

…and now action…


Mathematics
First of all: it is simple!!! First and second order derivatives.
(Very short) review of the mathematical background needed in this course to
handle partial differential equations (PDE): differential equations in which an
unknown function is a function of multiple (rather than single) independent
variables (space coordinates and time).

∂T " ∂2T ∂2T ∂2T %


Example: 3D Heat diffusion equation à = k$ 2 + 2 + 2 '
∂t # ∂x ∂y ∂z &

In this course we will use the finite difference method to operate differentiation
and numerically solve for PDEs
Finite difference method
First derivative of function f(x) (1D case): Example:

∂f ( x ) f ( x + Δx ) − f ( x ) ∂T ΔT T2 − T1
f !( x) = ≈ lim ≈ =
∂x Δx→0
(x + Δx) − ( x ) ∂x Δx x2 − x1

" ∂T %
Analytical vs Numerical $ '
T1 # ∂x & T2
x
x1 x2
Δx

The same is valid for first


derivative in time:

∂T ΔT T t+Δt − T t
≈ =
∂t Δt Δt
PDEs in this course and field variables
Continuum mechanics PDEs

 Conservation of mass for


∇⋅v = 0 incompressible media

 Conservation of momentum for


∇ ⋅ σ # − ∇P = −ρ g slowly flowing continuous media

DT  Conservation of energy
ρc P = −∇ ⋅ q + H
Dt

The unknown function upon which differentiation is operated describes a given


field variable. Field variables describe the physical properties of the medium.

Input field variables: viscosity, density, heat capacity, thermal conductivity,
initial temperature field, etc.
Output field variables: velocity, temperature, pressure, stress, strain rate
There are 3 major types of field variables:
• Scalars
• Vectors
• Tensors
Scalar
It is a number indicating the magnitude of a physical quantity, independent of
the coordinate system (invariant) à pressure (P), temperature (T), density (ρ)
…and many other rock physical properties

# ∂T ∂T ∂T &
Gradient (gives a vector): grad(T ) = ∇T = % ; ; (
$ ∂x ∂y ∂z '
#∂ ∂ ∂&
where del= ∇ =% ; ; ( is a vector differential operator
$ ∂x ∂y ∂z '
2 2 2
Laplacian (gives a scalar): ΔT = ∇ ⋅ ∇T = ∇ T = 2 ∂ T ∂ T ∂ T
2
+ 2+ 2
∂x ∂y ∂z
2
% ∂ 2
∂ 2
∂ 2
(
where Δ = ∇ ⋅ ∇ = ∇ = ' + 2 + 2 * is the Laplace operator
2
& ∂x ∂y ∂z )
Vector
It has a magnitude (length) and direction, the physical quantity is split into its

components à velocity ( v ), heat flux ( q ), gravity ( g )

!v x $
  # &
2
Magnitude (invariant): v = vx + vy + vz 2 2 vi = #vy &
(or Euclidean norm) #v &
" z%
  ∂vx ∂vy ∂vz
Divergence (gives a scalar, invariant): div(v) = ∇ ⋅ v = + +
$∂ ∂ ∂' ∂x ∂y ∂z
where: ∇⋅ = & + +
)
% ∂x ∂y ∂z (
Divergence of a vector represents the extent to which there is incoming or
outgoing flux of a given physical quantity:

div(v) < 0 : sink


div(v) = 0 : neutral
div(v) > 0 : source
Vector
Gradient of a vector (gives a matrix, called Jacobian):

# ∂vx ∂vx ∂vx &


% (
% ∂x ∂y ∂z (
 ∂vi % ∂vy ∂vy ∂vy (
∇v = =% (
∂j % ∂x ∂y ∂z (
% ∂vz ∂vz ∂vz (
% (
$ ∂x ∂y ∂z '
Vector
Curl (gives a vector): its magnitude expresses the amount of rotation, while its
direction is normal to the plane of rotation (using the right-hand rule).

∂ ∂
0 −
∂z ∂y % (
vx
  ∂ ∂ ' * + ∂vz ∂vy . + ∂vx ∂vz . + ∂vy ∂vx .
curl(v) = ∇ × v = 0 − 'v y * = - − 0+- − 0+- − 0
∂z ∂x ' * , ∂y ∂z / , ∂z ∂x / , ∂x ∂y /
∂ ∂ & vz )
− 0
∂y ∂x
1 
Vorticity: ω = ∇ × v
2

Product rule (Leibniz’s law): ( a ⋅ b)" = a" ⋅ b + b" ⋅ a


   
Example: divergence of mass flux à div ( ρ v ) = ∇ ⋅ ( ρ v ) = ρ∇ ⋅ v + v ⋅ ∇ρ
∂a ∂a ∂b ∂a ∂a ∂x ∂a ∂y
Chain rule: = or = +
∂x ∂b ∂x ∂t ∂x ∂t ∂y ∂t
Tensor
Stress ( σ ), strain ( ε ), strain rate ( ε )

!σ xx σ xy σ xz $
# &
σ ij = #σ yx σ yy σ yz &
#σ σ σ &
" zx zy zz %

Invariants (quantities independent of the coordinate system):

- First invariant à trace: tr (σ ) = (σ


ij xx
+ σ yy + σ zz )
- Second invariant à magnitude:

σ = 1 σ ij2 = 1 (σ xx2 + σ xy2 + σ xz2 + σ yx2 + σ yy2 + σ yz2 + σ zx2 + σ zy2 + σ zz2 )
2 2
- Third invariant à determinant
Tensor
Divergence (gives a vector):

$ ∂σ xx ∂σ xy ∂σ xz '
& + + )
& ∂x ∂y ∂z )
∂σ ij & ∂σ yx ∂σ yy ∂σ yz )
∇ ⋅ σ ij = =& + + )
∂j & ∂x ∂y ∂z )
& ∂σ zx ∂σ zy ∂σ zz )
& + + )
% ∂x ∂y ∂z (
Exercise
Write the following equations using partial derivatives in 2D:

 Conservation of mass for


∇⋅v = 0 incompressible media

 Conservation of momentum for


∇ ⋅ σ # − ∇P = −ρ g slowly flowing continuous media

DT  Conservation of energy
ρc P = −∇ ⋅ q + H
Dt
$ ∂f xx ∂f xy ∂f xz '
& + + )
# ∂f ∂f ∂f & & ∂x ∂y ∂z )
€ grad( f ) = ∇f = % ; ; (
$ ∂x ∂y ∂z ' ∂fij & ∂f yx ∂f yy ∂f yz )
∇ ⋅ fij = =& + + )
  ∂f ∂f y ∂f ∂j & ∂x ∂y ∂z )
div( f ) = ∇ ⋅ f = x + + z & ∂fzx ∂fzy ∂fzz )
∂x ∂y ∂z & + + )
% ∂x ∂y ∂z (
Few other rules…

Product rule (Leibniz’s law): ( f (x)⋅ g(x))" = f (x )" ⋅ g(x) + g(x )" ⋅ f (x)

   
Example: divergence of mass flux à div ( ρ v ) = ∇ ⋅ ( ρ v ) = ρ∇ ⋅ v + v ⋅ ∇ρ

Chain rule: df (x) ∂f (x) dx df (x, y) ∂f (x, y) dx ∂f (x, y) dy


= or = +
dt ∂x dt dt ∂x dt ∂y dt

Example:
d ρ (T, P) ∂ρ dT ∂ρ dP
= +
dt ∂T dt ∂P dt
Numerical Modelling in
Geosciences
Practice 1
…ok, now real action!
Useful information
Programming language & software: MatLab (any version)
____________________________________________________________

If not available, use Octave: open source, reads MatLab scripts and uses the same
programming language and API (application programming interface).
___________________________________________________________________

Download Octave at: http://octave.sourceforge.net/index.html

Download the graphical unit interface GUIOctave at:

https://sites.google.com/site/guioctave/

For problems related to the installation of


Octave softwares, ask (only if indispensable!)
to PhD candidate Luca Penasa.
___________________________________________________________________

Access to PCs in this room:


Username: faccenda
Password: faccenda2013
What MatLab is?

MATLAB® is a high-level language and interactive environment for numerical


computation, visualization, and programming. Using MATLAB, you can analyze
data, develop algorithms, and create models and applications.

It a very useful tool for beginners because many algorithms are already built in,
and we can readily analyze and visualize model results.

Let’s check how the graphical interface is organized…


Practice with MatLab
Exercise by:
• using help function and manual
• open a script file, how to run it and debug it.
• comment and semicolon
• defining scalar, vector, matrix and perform operations with them (e.g., a+b, a-
b, a*b and a.*b, a/b, a\b) (see next slide)
• exercise with functions exp, log, sin, sind, asin, asind, cos, tg, ctg.
• produce and plot 1D data (Practice 1)
• initialize empty arrays and matrices (i.e., a=zeros(2,1,'int8'))
• programming loops (for,while,end) and conditions (if,else,elseif,end, logical
(~,&&,||) and relational (<,>,==,>=,<=,~=) operators) (Practice 1)
• produce and plot 2D data (Practice 1b)
• open,close files (fopen,fclose) (Practice 1b)
• save,load data in different formats (save, load, fprintf, fread, fwrite, fscanf,
hdf5write, hdf5read) (Practice 1b)
See also: http://www.mathworks.com/help/matlab/ref/arithmeticoperators.html
Practice with MatLab
Exercise by:
• using help function and manual
• open a script file, how to run it and debug it.
• comment and semicolon
• defining scalar, vector, matrix and perform operations with them (e.g., a+b, a-
b, a*b and a.*b, a/b, a\b)
• exercise with functions exp, log, sin, sind, asin, asind, cos, tg, ctg.
• produce and plot 1D data (Practice 1)
• initialize empty arrays and matrices (i.e., a=zeros(2,1,'int8')) (see next slide)
• programming loops (for,while,end) and conditions (if,else,elseif,end, logical
(~,&&,||) and relational (<,>,==,>=,<=,~=) operators) (Practice 1)
• produce and plot 2D data (Practice 1b)
• open,close files (fopen,fclose) (Practice 1b)
• save,load data in different formats (save, load, fprintf, fread, fwrite, fscanf,
hdf5write, hdf5read) (Practice 1b)
Types of variables in MatLab and their storage
Field type Precision Bytes Specifier Numeric
in MatLab range
1 byte = 8 bits
Unsigned integers uint8 1 %u 0 | 28-1
“ uint16 2 %u 0 | 216-1
1 0 1 1 1 0 1 1
“ uint32 4 %u 0| 232-1 − − − − − − − −
“ uint64 8 %lu 0 | 264-1
Signed integers int8 1 %d -27 | 27-1 20+0+22+23+24+0+26+27 = 221
“ int16 2 %d -215 | 215-1
“ int32 4 %d -231 | 231-1
“ int64 8 %ld -263 | 263-1
Floating-point single 4 %f,%e,%g -2127 | 2127
“ double 8 %f,%e,%g -21023 | 21023

depends
Character string char on the %s,%c -
length of
the string

By default MatLab assignes to any number a double precision, i.e., maximum storage capacity.
If you want to reduce the storage, you need to specify the variable precision.
Practice with MatLab
Exercise by:
• using help function and manual
• open a script file, how to run it and debug it.
• comment and semicolon
• defining scalar, vector, matrix and perform operations with them (e.g., a+b, a-
b, a*b and a.*b, a/b, a\b)
• exercise with functions exp, log, sin, sind, asin, asind, cos, tg, ctg.
• produce and plot 1D data (Practice 1)
• initialize empty arrays and matrices (i.e., a=zeros(2,1,'int8'))
• programming loops (for,while,end) and conditions (if,else,elseif,end, logical
(~,&&,||) and relational (<,>,==,>=,<=,~=) operators) (Practice 1)
• produce and plot 2D data (Practice 1b)
• open,close files (fopen,fclose) (Practice 1b)
• save,load data in different formats (save, load, fprintf, fread, fwrite, fscanf,
hdf5write, hdf5read) (Practice 1b)
Numerical Modelling in
Geosciences
Practice 1b
Call external function
In a given m-script we call an external function (i.e., here we name it test_function)

In a different m-script named as the external function we can perform any operation,
Homework

To get motivated, read the Introduction chapter of textbook:

Gerya, T. Introduction to numerical geodynamic modelling.


Cambridge University Press, 345 pp. (2010)

Exercise with MatLab/Octave functions we have seen today

Study files Practice1.m and Practice1b.m

You might also like