0% found this document useful (0 votes)
46 views

Comparison of Two Different Implementations of A Finite-Difference-Method For First-Order Pde in M and M

Uploaded by

EMella
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Comparison of Two Different Implementations of A Finite-Difference-Method For First-Order Pde in M and M

Uploaded by

EMella
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Comparison of two different implementations of a

finite-difference-method for first-order pde in


M ATHEMATICA® and M ATLAB®
arXiv:cs.CE/0506051 v2 11 Nov 2005

Heiko Herrmann∗ † Gunnar Rückner∗

Abstract
In this article two implementations of a symmetric finite difference algorithm (ftcs-method)
for a first-order partial differential equation are discussed. The considered partial differen-
tial equation discribes the time evolution of the crack length ditribution of microcracks in
brittle materia.

1 Physics and analytical solution


The growth rate of microcracks in a brittle material can be discribed by a mesoscopic equation.
Here the specialized version for uniaxial loading is presented.
∂f (l, t) 1 ∂l2 vl (l, t)f (l, t)
= − 2 , (1)
∂t l ∂l
f (l, t) is the distribution function for the crack length l at time t, vl = l˙ is the growth velocity
of the cracks. A Rice-Griffith-like dynamic is assumed for crack growth, which gives
(
−α′ + β ′ lσ(t)2 , if α′ ≤ β ′ lσ 2
l˙ = (2)
0 , otherwise
The theory is given in detail in [1]. For an exponential (or a step-wise) initial condition and
constant loading speed it is possible to give an exact analytical solution, which is also presented
in [1] and looks like:
  
β ′ v2 β ′ v2 2
−2 − 3 σ t3 − 3 σ t3 α′ β ′ vσ 3
l e F le + (9β ′ v2 )1/3 Γ(1/3, 0, 3 t ) , if α′ ≤ β ′ vσ2 lt2



σ
f (l, t) = (3)



f (l, 0) , otherwise.


Technische Universität Berlin – Institut für Theoretische Physik – Sekr.: PN 7-1 – Hardenbergstr. 36 – 10623
Berlin – Germany

Correspondend autor: Heiko Herrmann

1
(a) step-wise initial condition (b) step-wise initial condition

(c) exponential initial condition

Figure 1: Analytical solution for crack lenght distributuion. Shown is f (l, t)l2 over l and t.

2
2 The numerical algorithm
The partial differential equations are first order in time and crack length. Two different al-
gorithms, upwind and fcts (forward time centered space), have been tested. The symmetric
algorithm (ftcs-method) is in this case a bit more stable than the upwind, which is somewhat
astonishing. Both algorithms can be found in [2].
In the symmetric algorithm f (l, t + 1) is calculated from f (l − 1, t), f (l, t) and f (l + 1, t) by
   
2 2α 2

f (l, t + 1) = f (l, t) 1 − 3βσ (t) − )dt − dl lβσ (t) − α ×
dl l
dt
× (f (l + 1, t) − f (l − 1, t)) (4)
2dl
This is what the main part of the implementation in M ATHEMATICA® looks like:
For[t = 1, t < TMAX, t++, For[l = 1, l < LMAX, l++,
If[l*dl*(t*dt)^2*be - al > 0,
If[l == 0, f[l, t + 1] = f[l, t],
f[l, t + 1] =
f[l, t]*(1 - (3*be*(t*dt)^2 - (2*al)/(dl*l))*dt) -
(dl*l*be*(t*dt)^2 - al)*dt/dl*(f[l + 1, t] - f[l - 1, t])],
f[l, t + 1] = f[l, t]
]
]
]

This is what the main part of the implementation in M ATLAB® looks like:
for t=1:1:TMAX-1
for l=1:1:LMAX-1
if (l.*dl.*sigma(t).*beta-alpha > 0)
f(l,t+1)=f(l,t).*(1-(3.*beta.*(sigma(t)).^2 - ...
(2.*alpha)./(dl.*l)).*dt)-(dl.*l.*beta.*(sigma(t)).^2 - ...
alpha).*dt./(2*dl).*(f(l+1,t)-f(l-1,t));
else
f(l,t+1)=f(l,t);
end
end
end

3
3 Results obtained by M ATHEMATICA®
M ATHEMATICA® is a general purpose computer algebra system (cas) by Wolfram Research
Inc.. As one can see the solution shows some wave-like efects, which can be interpreted as a

(a) step-wise initial condition (b) exponential initial condition

Figure 2: Numerical solution for crack lenght distributuion calculated with M ATHEMATICA®

sign for numerical instability. This instability is a result of the discontinous initial condition.

4
4 Results obtained by M ATLAB®
M ATLAB® is a tool for numerical mathematics, especially designed for matrix manipulation,
by The MathWorks Inc.. Here in both cases huge instabilities occur. As soon as some cracks

(a) step-wise initial condition (b) exponential initial condition

Figure 3: Numerical solution for crack lenght distributuion calculated with M ATLAB®

start growing the numerical error goes to infinity. The following pictures show an extract of the
above pictures.

(a) step-wise initial condition (b) exponential initial condition

Figure 4: Numerical solution for crack lenght distributuion calculated with M ATLAB® (extract
of figure 3)

5
5 Comparison of the results and conclusion
Obviously the results, obtained with both programs, show huge errors. But in contrast to the
results calculated with M ATLAB® , one can use the results obtained with M ATHEMATICA® at
least for some rough predictions.
The difference in the two software packages, used for these simulations, is that M ATLAB® uses
floating-point variables of precision “double” (16 byte), whereas M ATHEMATICA® is capable
of both numerical and symolic computation. Therefore it is possible that M ATHEMATICA® uses
a much higher precision to perform some of the operations than M ATLAB® .

Acknowledgement
We thank Dr. Christina Papenfuß and Dr. Peter Ván for discussions. Financial support by the
DAAD, OTKA and by the VISHAY Company, 95100 Selb, Germany, is greatfully acknowl-
edged.

References
[1] P. Ván, C. Papenfuss, and W. Muschik. Griffith cracks in the mesoscopic microcrack theory.
Journal of Physics A, 37(20):5315–5328, 2004. (cond-mat/0211207).

[2] W. H. Press, S. A. Teukolsky, W. T Vetterling, and B. P. Flannery. Numerical Recipes in C.


Cambridge University Press, Cambridge, USA, 1994.

You might also like