11 
% 
% 
12 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
13 



flexibility on modeling 

14 
\chapter{Introduction} 
\chapter{Introduction} 
15 
\label{CHAP INTRO} 
\label{CHAP INTRO} 
16 
\section{Why \esc?} 
\section{Why \esc?} 
17 
\esc is an environment for mathematical modeling based on partial differential equations (PDEs). 
\esc is an environment for mathematical modelling based on partial differential equations (PDEs). It provides a highlevel of abstraction from the underlying numerical schemes (e.g. finite elements (FEM)) and their implementations (e.g.. from aspects of parallelization) so the user can concentrate more on the modelling aspects of their problem while still properly utilising the powerful mathematical capabilities of PDEs. \esc is built upon the interpretive programming language python\footnote{see \url{www.python.org} }. Python is a basic scripting language with many underlying functions. There are also a large number of software tools for python which can be run in conjunction with \esc; these include packages for linear algebra, visualization, image processing, data plotting, and many others. Any scripts written for \esc is scalable with the ability to run on desktop computers right through to supercomputers\footnote{\esc supports distributed memory architectures with multicore processors through MPI and threading.} with no modifications to the scripts. 
18 
By using the mathematical language of PDEs 

19 
it provides a highlevel of abstraction from the underlying numerical schemes (e.g. finite elements (FEM)) and their implementations (eg. from aspects of parallelization) so in their work user can concentrate on the modelling aspects. 
There are many benefits to using a software platform like \esc for your mathematical modelling project. Using an existing environment such as \esc rather than starting from scratch saves software development time and solves fundamental numerical problems such as selecting appropriate data structures and establishing numerical algorithms. \esc has already solved these problems and their implementation has been heavily tested for bugs. While a developed environment may not provide the user with the fastest algorithms for their problem, it is generally the case that, the overall time of implementing and testing an optimal algorithm will exceed the time needed to use already proven software. This is particularly true if a simulation does not need to be executed repetitively or has relatively short lifetime. A model for publication or thesis would be one such instance. 
20 
Modelling codes are portable from desktop computers upto supercomputers\footnote{\esc suports distributed memory architectures with multcore processors through MPI and threading.} with no modifications to the code. \esc is 

21 
integrated into the interpretive programming languge python\footnote{see \url{www.python.org} } which gives users direct access a large number 
When it comes to solving partial differential equations \esc provides an advantage as it is especially design for PDEs rather than being an addon to a linear algebra focused system (e.g. MATLAB). The \esc approach gives the user a cleaner environment to work with and provides better efficiency when dealing with PDE coefficients such as permeability. Data structure in \esc allow the user to abstract them selves from problems like the data type of these coefficients. If a model has been tested with constant permeability the unchanged code can be run with variable permeability set from a data base or as a spatially dependent variable like temperature dependence. This capability of \esc is possible because \esc uses the language of PDEs (as opposed to linear algebra) to describe a model. As it turns out, the \esc approach can efficiently be applied in very large software projects as it leads to a clearer structure for the code by separating modelling issues from lowlevel numerical and code performance issues but at the same time allows implementing complex model coupling on a higherlevel. Moreover, the usage of python as development platform for \esc greatly simplifies the development of models from a user prospective as python is intuitive and easy to learn even for users with little experience in programming and on the other hand provides direct access to a very large number of tools making python an attractive tool for experienced programmers. 
22 
of software tool for linear algebra, visualization, image processing, data plotting, and many others. 

23 

Best of all, \esc is released under an open software license and is available freely for download. 
24 
If you start a mathematical modelling project, what are the benefits for you using \esc as a software 

25 
platform for your project? Using an existing environment such as \esc rather than starting from scratch saves software development time as fundamental problems eg. to find appropriate data structures and numerical algorithms have already been solved and their implemenation has heavily tested. Even if the environment may not provide the user with the fastest algorithms for his/her problem, in most cases the overall time of implementing and testing an optimal algorithm is exceeding the time for using tested software. This is a particular advantage if a simulation code has relatively short lifetime, for instance when used for a publication, in a thesis. When it comes to solving partial differential equations \esc provides the ad vantage that is especially design for PDEs rather than beeing an addon to a linear algebra focued system (e.g. MATLAB). The \esc approach gives the user a cleaner 
\section{How to use this Cookbook} 
26 
environment to work with and provides better efficiency when dealing with PDE coefficients such as permeabilty. 
This manual is written with the intention of giving new users a practical introduction to \esc by solving a variety of simple to advanced problems. \esc has many modules and dependencies along with some subtleties that need to be massaged to get you where you want to go. It is recommended that new users work through the \textit{Introduction} (\refCh{CHAP INTRO}) and the \textit{first two sets of examples} (\refCh{CHAP HEAT DIFF} and \refCh{CHAP HEAT 2}) which present the necessary basic knowledge and explain some of the more common aspects and modules of \esc. The examples are simple but they give reference to implementation of PDEs, data structures, how to create models and visualising the solution. 
27 
For instance, the user does not need to worry about the data type of permeabilty while implementing the model: 

28 
If a model has been tested with constant permeabilty the unchanged code can be run with variable permeabilty set from a data base or as a spatically dependent variable eg. through temperature dependence. This capability of \esc bases on the fact that \esc is 
Future chapters will cover more advanced topics and more complex models. 
29 
using the language of PDEs (rather than linear algebra) to describe a model. As it turned out the \esc approach can efficiently be applied even in bigger software projects as it leads to clearer structure for the code by separting modelling issues from lowlevel numerical and code performance issues but at the same time allows implementing complex model coupling on a higherlevel. Moreover, 

30 
the usage of python as development platform for \esc greatly simplifies the development of models from a user prospectiv as 
The examples covered in this cookbook have all been scripted and are ready to run. They are available from the \exf folder in the escript directory. The scripts provide a basis for users to develop their own models while at the same time demonstrating the steps required to completely solve and visualise a PDE model. 

python is intuitive and easy to learn even for users with little experience in program and on the other hand provides direct 


access to a very large number of tools making python an attractive tool for experienced programmers. 





\section{How to use the Cookbook} 


This manual is written with the intention to give new users a practical introduction for using \esc to solve a given problem. It is recommended that a new user works through 


the introduction chapter~\ref{CHAP INTRO} and the first chapter~\ref{CHAP HEAT DIFF} which present the neccessary basic knowledge and a set of simple examples which cover basic expertise for using \esc Other chapters 


will cover aspects users hit when solving problems with intention to provide ready to use solutions. 


All of the \esc scripts associated with this document are available from the examples folder. 

31 


32 
\input{quickstart} 
\input{quickstart} 
33 
\input{escpybas} 
\input{escpybas} 

\input{einsteinETA} 


\input{PDEsintro} 
