/[escript]/trunk/doc/user/escript.tex
ViewVC logotype

Contents of /trunk/doc/user/escript.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3279 - (show annotations)
Fri Oct 15 04:02:06 2010 UTC (9 years ago) by caltinay
File MIME type: application/x-tex
File size: 63273 byte(s)
Some corrections to 1.3 of user's guide and defined graphicspath globally.

1
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % Copyright (c) 2003-2010 by University of Queensland
5 % Earth Systems Science Computational Center (ESSCC)
6 % http://www.uq.edu.au/esscc
7 %
8 % Primary Business: Queensland, Australia
9 % Licensed under the Open Software License version 3.0
10 % http://www.opensource.org/licenses/osl-3.0.php
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14
15 \chapter{The Module \escript}
16 \label{ESCRIPT CHAP}
17
18
19 \begin{figure}
20 \includegraphics[width=\textwidth]{EscriptDiagram1}
21 \caption{\label{ESCRIPT DEP}Dependency of Function Spaces in Finley. An arrow indicates that a function in the
22 function space at the starting point can be interpolated to the function space of the arrow target.
23 All function spaces on the left side can be interpolated to any of the \FunctionSpace-s on the right.
24 See also Section~\ref{SEC Projection}.}
25 \end{figure}
26
27 \escript is a Python module that allows you to represent the values of
28 a function at points in a \Domain in such a way that the function will
29 be useful for the Finite Element Method (FEM) simulation. It also
30 provides what we call a function space that describes how the data is
31 used in the simulation. Stored along with the data is information
32 about the elements and nodes which will be used by \finley.
33
34 In order to understand what we mean by the term 'function space',
35 consider that the solution of a partial differential equation
36 \index{partial differential equation} (PDE) is a function on a domain
37 $\Omega$. When solving a PDE using FEM, the solution is
38 piecewise-differentiable but, in general, its gradient is
39 discontinuous. To reflect these different degrees of smoothness,
40 different function spaces are used. For instance, in FEM, the
41 displacement field is represented by its values at the nodes of the
42 mesh, and so is continuous. The strain, which is the symmetric
43 part of the gradient of the displacement field, is stored on the
44 element centers, and so is considered to be discontinuous.
45
46 A function space is described by a \FunctionSpace object. The
47 following statement generates the object \var{solution_space} which is
48 a \FunctionSpace object and provides access to the function space of
49 PDE solutions on the \Domain \var{mydomain}:
50
51 \begin{python}
52 solution_space=Solution(mydomain)
53 \end{python}
54 The following generators for function spaces on a \Domain \var{mydomain} are commonly used:
55 \begin{itemize}
56 \item \var{Solution(mydomain)}: solutions of a PDE.
57 \item \var{ReducedSolution(mydomain)}: solutions of a PDE with a reduced smoothness requirement, eg. using a
58 lower order approximation on the same element or using macro elements\index{macro elements}.
59 \item \var{ContinuousFunction(mydomain)}: continuous functions, eg. a temperature distribution.
60 \item \var{Function(mydomain)}: general functions which are not necessarily continuous, eg. a stress field.
61 \item \var{FunctionOnBoundary(mydomain)}: functions on the boundary of the domain, eg. a surface pressure.
62 \item \var{FunctionOnContact0(mydomain)}: functions on side $0$ of the discontinuity.
63 \item \var{FunctionOnContact1(mydomain)}: functions on side $1$ of the discontinuity.
64 \end{itemize}
65 In some cases under-integration is used. For these cases the user may use a
66 \FunctionSpace from the following list:
67 \begin{itemize}
68 \item \var{ReducedFunction(mydomain)}
69 \item \var{ReducedFunctionOnBoundary(mydomain)}
70 \item \var{ReducedFunctionOnContact0(mydomain)}
71 \item \var{ReducedFunctionOnContact1(mydomain)}
72 \end{itemize}
73 In comparison to the corresponding full version
74 they use a reduced number of integration nodes (typically one only) to represent values.
75
76
77 The reduced smoothness for PDE solution is often used to fulfill the Ladyzhenskaya–-Babuska–-Brezzi condition \cite{LBB} when
78 solving saddle point problems \index{saddle point problems}, eg. the Stokes equation.
79 A discontinuity \index{discontinuity} is a region within the domain across which functions may be discontinuous.
80 The location of discontinuity is defined in the \Domain object.
81 \fig{ESCRIPT DEP} shows the dependency between the types of function spaces in \finley (other libraries may have different relationships).
82
83 The solution of a PDE is a continuous function. Any continuous function can be seen as a general function
84 on the domain and can be restricted to the boundary as well as to one side of
85 discontinuity (the result will be different depending on
86 which side is chosen). Functions on any side of the
87 discontinuity can be seen as a function on the corresponding other side.
88
89 A function on the boundary or on one side of
90 the discontinuity cannot be seen as a general function on the domain as there are no values
91 defined for the interior. For most PDE solver libraries
92 the space of the solution and continuous functions is identical, however in some cases, eg.
93 when periodic boundary conditions are used in \finley, a solution
94 fulfills periodic boundary conditions while a continuous function does not have to be periodic.
95
96 The concept of function spaces describes the properties of
97 functions and allows abstraction from the actual representation
98 of the function in the context of a particular application. For instance,
99 in the FEM context a
100 function of the \Function type (written as \emph{Function()} in Figure~\ref{ESCRIPT DEP})
101 is usually represented by its values at the element center,
102 but in a finite difference scheme the edge midpoint of cells is preferred.
103 By changing its function space you can use the same function in a Finite Difference
104 scheme instead of Finite Element scheme.
105 Changing the function space of a particular function
106 will typically lead to a change of its representation.
107 So, when seen as a general function,
108 a continuous function which is typically represented by its values
109 on the node of the FEM mesh or finite difference grid
110 must be interpolated to the element centers or the cell edges,
111 respectively\index{interpolation}. Interpolation happens automatically in \escript
112 whenever it is required\index{interpolation}. The user needs to be aware that an
113 interpolation is not always possible, see Figure~\ref{ESCRIPT DEP} for \finley.
114 An alternative approach to change the representation (=\FunctionSpace) is
115 projection, see Section~\ref{SEC Projection}
116 \index{projection}\index{interpolation}.
117
118
119 In \escript the class that stores these functions is called \Data.
120 The function is represented through its values on \DataSamplePoints where
121 the \DataSamplePoints are chosen according to the function space
122 of the function.
123 \Data class objects are used to define the coefficients
124 of the PDEs to be solved by a PDE solver library
125 and also to store the solutions of the PDE.
126
127 The values of the function have a rank which gives the
128 number of indices, and a \Shape defining the range of each index.
129 The rank in \escript is limited to the range $0$ through $4$ and
130 it is assumed that the rank and \Shape is the same for all \DataSamplePoints.
131 The \Shape of a \Data object is a tuple (list) \var{s} of integers. The length
132 of \var{s} is the rank of the \Data object and the \var{i}-th index ranges between $0$ and $\var{s[i]}-1$.
133 For instance, a stress field has rank $2$ and
134 \Shape $(d,d)$ where $d$ is the spatial dimension.
135 The following statement creates the \Data object
136 \var{mydat} representing a
137 continuous function with values
138 of \Shape $(2,3)$ and rank $2$:
139 \begin{python}
140 mydat=Data(value=1,what=ContinuousFunction(myDomain),shape=(2,3))
141 \end{python}
142 The initial value is the constant $1$ for all \DataSamplePoints and
143 all components.
144
145 \Data objects can also be created from any \numpy
146 array or any object, such as a list of floating point numbers,
147 that can be converted into a \numpyNDA \cite{NUMPY}.
148 The following two statements
149 create objects which are equivalent to \var{mydat}:
150 \begin{python}
151 mydat1=Data(value=numpy.ones((2,3)),what=ContinuousFunction(myDomain))
152 mydat2=Data(value=[[1,1],[1,1],[1,1]],what=ContinuousFunction(myDomain))
153 \end{python}
154 In the first case the initial value is \var{numpy.ones((2,3))}
155 which generates a $2 \times 3$ matrix as a \numpyNDA
156 filled with ones. The \Shape of the created \Data object
157 it taken from the \Shape of the array. In the second
158 case, the creator converts the initial value, which is a list of lists,
159 and converts it into a \numpyNDA before creating the actual
160 \Data object.
161
162 For convenience \escript provides creators for the most common types
163 of \Data objects in the following forms (\var{d} defines the
164 spatial dimension):
165 \begin{itemize}
166 \item \var{Scalar(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(,))} (each value is a scalar),
167 e.g a temperature field.
168 \item \var{Vector(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d))} (each value is a vector), e.g
169 a velocity field.
170 \item \var{Tensor(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d))},
171 eg. a stress field.
172 \item \var{Tensor4(0,Function(mydomain))} is the same as \var{Data(0,Function(myDomain),(d,d,d,d))}
173 eg. a Hook tensor field.
174 \end{itemize}
175 Here the initial value is $0$ but any object that can be converted into a \numpyNDA and whose \Shape
176 is consistent with \Shape of the \Data object to be created can be used as the initial value.
177
178 \Data objects can be manipulated by applying unary operations (eg. cos, sin, log) point
179 and can be combined point-wise by applying arithmetic operations (eg. +, - ,* , /).
180 It is to be emphasized that \escript itself does not handle any spatial dependencies as
181 it does not know how values are interpreted by the processing PDE solver library.
182 However \escript invokes interpolation if this is needed during data manipulations.
183 Typically, this occurs in binary operation when both arguments belong to different
184 function spaces or when data are handed over to a PDE solver library
185 which requires functions to be represented in a particular way.
186
187 The following example shows the usage of {\tt Data} objects: Assume we have a
188 displacement field $u$ and we want to calculate the corresponding stress field
189 $\sigma$ using the linear--elastic isotropic material model
190 \begin{eqnarray}\label{eq: linear elastic stress}
191 \sigma\hackscore {ij}=\lambda u\hackscore {k,k} \delta\hackscore {ij} + \mu ( u\hackscore {i,j} + u\hackscore {j,i})
192 \end{eqnarray}
193 where $\delta\hackscore {ij}$ is the Kronecker symbol and
194 $\lambda$ and $\mu$ are the Lame coefficients. The following function
195 takes the displacement {\tt u} and the Lame coefficients
196 \var{lam} and \var{mu} as arguments and returns the corresponding stress:
197 \begin{python}
198 from esys.escript import *
199 def getStress(u,lam,mu):
200 d=u.getDomain().getDim()
201 g=grad(u)
202 stress=lam*trace(g)*kronecker(d)+mu*(g+transpose(g))
203 return stress
204 \end{python}
205 The variable
206 \var{d} gives the spatial dimension of the
207 domain on which the displacements are defined.
208 \var{kronecker} returns the Kronecker symbol with indexes
209 $i$ and $j$ running from $0$ to \var{d}-1. The call \var{grad(u)} requires
210 the displacement field \var{u} to be in the \var{Solution} or \ContinuousFunction
211 function space. The result \var{g} as well as the returned stress will be in the \Function function space.
212 If, for example, \var{u} is the solution of a PDE then \var{getStress} might be called
213 in the following way:
214 \begin{python}
215 s=getStress(u,1.,2.)
216 \end{python}
217 However \var{getStress} can also be called with \Data objects as values for
218 \var{lam} and \var{mu} which,
219 for instance in the case of a temperature dependency, are calculated by an expression.
220 The following call is equivalent to the previous example:
221 \begin{python}
222 lam=Scalar(1.,ContinuousFunction(mydomain))
223 mu=Scalar(2.,Function(mydomain))
224 s=getStress(u,lam,mu)
225 \end{python}
226
227 The function \var{lam} belongs to the \ContinuousFunction function space
228 but with \var{g} the function \var{trace(g)} is in the \Function function space.
229 In the evaluation of the product \var{lam*trace(g)} we have different function
230 spaces (on the nodes versus in the centers) and at first glance we have incompatible data.
231 \escript converts the arguments in an appropriate function space according to
232 Table~\ref{ESCRIPT DEP}. In this example that means
233 \escript sees \var{lam} as a function of the \Function function space.
234 In the context of FEM this means the nodal values of
235 \var{lam} are interpolated to the element centers.
236 The interpolation is automatic and requires no special handling.
237
238 \begin{figure}
239 \includegraphics[width=\textwidth]{EscriptDiagram2}
240 \caption{\label{Figure: tag}Element Tagging. A rectangular mesh over a region with two rock types {\it white} and {\it gray}.
241 The number in each cell refers to the major rock type present in the cell ($1$ for {\it white} and $2$ for {\it gray}).
242 }
243 \end{figure}
244
245 Material parameters such as the Lame coefficients are typically dependent on rock types present in the
246 area of interest. A common technique to handle these kinds of material parameters is "tagging"\index{tagging}, which
247 uses storage efficiently. Figure \fig{Figure: tag}
248 shows an example. In this case two rock types {\it white} and {\it gray} can be found in the domain. The domain
249 is subdivided into triangular shaped cells. Each
250 cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate
251 rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated
252 and stored in the \Domain class object. To allow easier usage of tags, names can be used instead of numbers. These names are typically defined
253 at the time when the geometry is generated.
254
255 The following statements show how, for the
256 example of \fig{Figure: tag}, the stress calculation discussed above and tagged values are used for
257 \var{lam}:
258 \begin{python}
259 lam=Scalar(value=2.,what=Function(mydomain))
260 insertTaggedValue(lam,white=30.,gray=5000.)
261 s=getStress(u,lam,2.)
262 \end{python}
263 In this example \var{lam} is set to $30$ for those cells with tag {\it white} (=$1$) and to $5000.$ for those cells
264 with tag {\it gray} (=$2$_. The initial value $2$ of \var{lam} is used as a default value for the case when a tag
265 is encountered which has not been linked with a value. The \var{getStress} method
266 does not need to be changed now that we are using tags.
267 \escript resolves the tags when \var{lam*trace(g)} is calculated.
268
269 This brings us to a very important point about \escript.
270 You can develop a simulation with constant Lame coefficients, and then later switch to tagged
271 Lame coefficients without otherwise changing your python script.
272 In short, you can use the same script to model with different domains and different types of input data.
273
274 There are three main ways in which \Data objects are represented internally: constant, tagged, and expanded.
275 In the constant case, the same value is used at each sample point and only a single value is stored to save memory.
276 In the expanded case, each sample point has an individual value (such as for the solution of a PDE).
277 This is where your largest data sets will be created because the values are stored as a complete array.
278 The tagged case has already been discussed above.
279
280 Expanded data is created when you create a \Data object with expanded=True.
281 Tagged data sets are created when you use the insertTaggedValue() method as shown above.
282
283 Values are accessed through a sample reference number. Operations on expanded \Data
284 objects have to be performed for each sample point individually. When tagged values are used, the values are
285 held in a dictionary. Operations on tagged data require processing the set of tagged values only, rather than
286 processing the value for each individual sample point.
287 \escript allows any mixture of constant, tagged and expanded data in a single expression.
288
289 \Data objects can be written to disk files and read with \var{dump} and \var{load}, both of which use \netCDF\cite{NETCDF}.
290 Use these to save data for visualization, checkpoint/restart or simply to save and reuse data that was expensive to compute.
291
292 For instance to save the coordinates of the data points of the
293 \ContinuousFunction to the file {\tt x.nc} use
294 \begin{python}
295 x=ContinuousFunction(mydomain).getX()
296 x.dump("x.nc")
297 mydomain.dump(`dom.nc`)
298 \end{python}
299 To recover the object \var{x} and \var{mydomain} was a \finley mesh use
300 \begin{python}
301 from esys.finley import LoadMesh
302 mydomain=LoadMesh('dom.nc')
303 x=load("x.nc", mydomain)
304 \end{python}
305 It possible to rerun the mechanism that was originally used to generates
306 \var{mydomain} to recreate \var{mydomain}. However in most cases using \var{dump} and
307 load is faster in particular if optimization has been applied. In case that
308 \escript is running on more than one \MPI processor the \var{dump} will create an individual file for each processor containing the local data. In order to avoid conflicts the file name is extended by the \MPI processor rank.
309
310 The function space of the \Data is stored in {\tt x.nc}, though.
311 If the \Data object
312 is expanded, the number of data points in the file and of the \Domain for the particular \FunctionSpace must match.
313 Moreover, the ordering of the values is checked using the reference identifiers provided by
314 \FunctionSpace on the \Domain. In some cases, data points will be re-ordered. Take care to be sure you get what you want!
315
316
317 \section{\escript Classes}
318 \declaremodule{extension}{esys.escript}
319 \modulesynopsis{Data manipulation}
320
321 \subsection{\Domain class}
322 \begin{classdesc}{Domain}{}
323 A \Domain object is used to describe a geometric region together with
324 a way of representing functions over this region.
325 The \Domain class provides an abstract interface to the domain of \FunctionSpace and \Data objects.
326 \Domain needs to be subclassed in order to provide a complete implementation.
327 \end{classdesc}
328 The following methods are available:
329 \begin{methoddesc}[Domain]{getDim}{}
330 returns the spatial dimension of the \Domain.
331 \end{methoddesc}
332 \begin{methoddesc}[Domain]{dump}{filename}
333 dumps the \Domain into the file \var{filename}.
334 \end{methoddesc}
335 \begin{methoddesc}[Domain]{getX}{}
336 returns the locations in the \Domain. The \FunctionSpace of the returned
337 \Data object is chosen by the \Domain implementation. Typically it will be
338 in the \Function.
339 \end{methoddesc}
340
341 \begin{methoddesc}[Domain]{setX}{newX}
342 assigns a new location to the \Domain. \var{newX} has to have \Shape $(d,)$
343 where $d$ is the spatial dimension of the domain. Typically \var{newX} must be
344 in the \ContinuousFunction but the space actually to be used depends on the \Domain implementation.
345 \end{methoddesc}
346
347 \begin{methoddesc}[Domain]{getNormal}{}
348 returns the surface normals on the boundary of the \Domain as \Data object.
349 \end{methoddesc}
350
351 \begin{methoddesc}[Domain]{getSize}{}
352 returns the local sample size, e.g. the element diameter, as \Data object.
353 \end{methoddesc}
354
355 \begin{methoddesc}[Domain]{setTagMap}{tag_name, tag}
356 defines a mapping of the tag name \var{tag_name} to the \var{tag}.
357 \end{methoddesc}
358 \begin{methoddesc}[Domain]{getTag}{tag_name}
359 returns the tag associated with the tag name \var{tag_name}.
360 \end{methoddesc}
361 \begin{methoddesc}[Domain]{isValidTagName}{tag_name}
362 return \True if \var{tag_name} is a valid tag name.
363 \end{methoddesc}
364
365 \begin{methoddesc}[Domain]{__eq__}{arg}
366 (python == operator) returns \True if the \Domain \var{arg} describes the same domain. Otherwise
367 \False is returned.
368 \end{methoddesc}
369
370 \begin{methoddesc}[Domain]{__ne__}{arg}
371 (python != operator) returns \True if the \Domain \var{arg} does not describe the same domain.
372 Otherwise \False is returned.
373 \end{methoddesc}
374
375 \begin{methoddesc}[Domain]{__str__}{arg}
376 (python str() function) returns string representation of the \Domain.
377 \end{methoddesc}
378
379 \begin{methoddesc}[Domain]{onMasterProcessor)}{}
380 returns \True if the processor is the master processor within
381 the \MPI processor group used by the \Domain. This is the processor with rank 0.
382 If \MPI support is not enabled the return value is always \True.
383 \end{methoddesc}
384
385 \begin{methoddesc}[Domain]{getMPISize}{}
386 returns the number of \MPI processors used for this \Domain. If \MPI support is not enabled
387 1 is returned.
388 \end{methoddesc}
389
390 \begin{methoddesc}[Domain]{getMPIRank}{}
391 returns the rank of the processor executing the statement
392 within the \MPI processor group used by the \Domain.
393 If \MPI support is not enabled 0 is returned.
394 \end{methoddesc}
395
396 \begin{methoddesc}[Domain]{MPIBarrier}{}
397 executes barrier synchronization within
398 the \MPI processor group used by the \Domain.
399 If \MPI support is not enabled, this command does nothing.
400 \end{methoddesc}
401
402 \subsection{\FunctionSpace class}
403 \begin{classdesc}{FunctionSpace}{}
404 \FunctionSpace objects are used to define properties of \Data objects, such as continuity. \FunctionSpace objects
405 are instantiated by generator functions. A \Data object in a particular \FunctionSpace is
406 represented by its values at \DataSamplePoints which are defined by the type and the \Domain of the
407 \FunctionSpace.
408 \end{classdesc}
409 The following methods are available:
410 \begin{methoddesc}[FunctionSpace]{getDim}{}
411 returns the spatial dimension of the \Domain of the \FunctionSpace.
412 \end{methoddesc}
413
414
415
416 \begin{methoddesc}[FunctionSpace]{getX}{}
417 returns the location of the \DataSamplePoints.
418 \end{methoddesc}
419
420 \begin{methoddesc}[FunctionSpace]{getNormal}{}
421 If the domain of functions in the \FunctionSpace
422 is a hyper-manifold (e.g. the boundary of a domain)
423 the method returns the outer normal at each of the
424 \DataSamplePoints. Otherwise an exception is raised.
425 \end{methoddesc}
426
427 \begin{methoddesc}[FunctionSpace]{getSize}{}
428 returns a \Data objects measuring the spacing of the \DataSamplePoints.
429 The size may be zero.
430 \end{methoddesc}
431
432 \begin{methoddesc}[FunctionSpace]{getDomain}{}
433 returns the \Domain of the \FunctionSpace.
434 \end{methoddesc}
435
436 \begin{methoddesc}[FunctionSpace]{setTags}{new_tag, mask}
437 assigns a new tag \var{new_tag} to all data sample
438 where \var{mask} is positive for a least one data point.
439 \var{mask} must be defined on the this \FunctionSpace.
440 Use the \var{setTagMap} to assign a tag name to \var{new_tag}.
441 \end{methoddesc}
442
443 \begin{methoddesc}[FunctionSpace]{__eq__}{arg}
444 (python == operator) returns \True if the \Domain \var{arg} describes the same domain. Otherwise
445 \False is returned.
446 \end{methoddesc}
447
448 \begin{methoddesc}[FunctionSpace]{__ne__}{arg}
449 (python != operator) returns \True if the \Domain \var{arg} do not describe the same domain.
450 Otherwise \False is returned.
451 \end{methoddesc}
452
453 \begin{methoddesc}[Domain]{__str__}{g}
454 (python str() function) returns string representation of the \Domain.
455 \end{methoddesc}
456
457 The following function provide generators for \FunctionSpace objects:
458 \begin{funcdesc}{Function}{domain}
459 returns the \Function on the \Domain \var{domain}. \Data objects in this type of \Function
460 are defined over the whole geometric region defined by \var{domain}.
461 \end{funcdesc}
462
463 \begin{funcdesc}{ContinuousFunction}{domain}
464 returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function
465 are defined over the whole geometric region defined by \var{domain} and assumed to represent
466 a continuous function.
467 \end{funcdesc}
468
469 \begin{funcdesc}{FunctionOnBoundary}{domain}
470 returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function
471 are defined on the boundary of the geometric region defined by \var{domain}.
472 \end{funcdesc}
473
474 \begin{funcdesc}{FunctionOnContactZero}{domain}
475 returns the \FunctionOnContactZero the \Domain domain. \Data objects in this type of \Function
476 are defined on side 0 of a discontinuity within the geometric region defined by \var{domain}.
477 The discontinuity is defined when \var{domain} is instantiated.
478 \end{funcdesc}
479
480 \begin{funcdesc}{FunctionOnContactOne}{domain}
481 returns the \FunctionOnContactOne on the \Domain domain.
482 \Data objects in this type of \Function
483 are defined on side 1 of a discontinuity within the geometric region defined by \var{domain}.
484 The discontinuity is defined when \var{domain} is instantiated.
485 \end{funcdesc}
486
487 \begin{funcdesc}{Solution}{domain}
488 returns the \SolutionFS on the \Domain domain. \Data objects in this type of \Function
489 are defined on geometric region defined by \var{domain} and are solutions of
490 partial differential equations \index{partial differential equation}.
491 \end{funcdesc}
492
493 \begin{funcdesc}{ReducedSolution}{domain}
494 returns the \ReducedSolutionFS on the \Domain domain. \Data objects in this type of \Function
495 are defined on geometric region defined by \var{domain} and are solutions of
496 partial differential equations \index{partial differential equation} with a reduced smoothness
497 for the solution approximation.
498 \end{funcdesc}
499
500 \subsection{\Data Class}
501 \label{SEC ESCRIPT DATA}
502
503 The following table shows arithmetic operations that can be performed point-wise on
504 \Data objects.
505 \begin{tableii}{l|l}{textrm}{expression}{Description}
506 \lineii{+\var{arg0}} {identical to \var{arg} \index{+}}
507 \lineii{-\var{arg0}} {negation\index{-}}
508 \lineii{\var{arg0}+\var{arg1}} {adds \var{arg0} and \var{arg1} \index{+}}
509 \lineii{\var{arg0}*\var{arg1}} {multiplies \var{arg0} and \var{arg1} \index{*}}
510 \lineii{\var{arg0}-\var{arg1}} {difference \var{arg1} from\var{arg1} \index{-}}
511 \lineii{\var{arg0}/\var{arg1}} {divide \var{arg0} by \var{arg1} \index{/}}
512 \lineii{\var{arg0}**\var{arg1}} {raises \var{arg0} to the power of \var{arg1} \index{**}}
513 \end{tableii}
514 At least one of the arguments \var{arg0} or \var{arg1} must be a
515 \Data object.
516 Either of the arguments may be a \Data object, a python number or a \numpy object.
517
518 If \var{arg0} or \var{arg1} are
519 not defined on the same \FunctionSpace, then an attempt is made to convert \var{arg0}
520 to the \FunctionSpace of \var{arg1} or to convert \var{arg1} to
521 the \FunctionSpace of \var{arg0}. Both arguments must have the same
522 \Shape or one of the arguments may be of rank 0 (a constant).
523
524 The returned \Data object has the same \Shape and is defined on
525 the \DataSamplePoints as \var{arg0} or \var{arg1}.
526
527 The following table shows the update operations that can be applied to
528 \Data objects:
529 \begin{tableii}{l|l}{textrm}{expression}{Description}
530 \lineii{\var{arg0}+=\var{arg2}} {adds \var{arg0} to \var{arg2} \index{+}}
531 \lineii{\var{arg0}*=\var{arg2}} {multiplies \var{arg0} with \var{arg2} \index{*}}
532 \lineii{\var{arg0}-=\var{arg2}} {subtracts \var{arg2} from\var{arg2} \index{-}}
533 \lineii{\var{arg0}/=\var{arg2}} {divides \var{arg0} by \var{arg2} \index{/}}
534 \lineii{\var{arg0}**=\var{arg2}} {raises \var{arg0} by \var{arg2} \index{**}}
535 \end{tableii}
536 \var{arg0} must be a \Data object. \var{arg1} must be a
537 \Data object or an object that can be converted into a
538 \Data object. \var{arg1} must have the same \Shape as
539 \var{arg0} or have rank 0. In the latter case it is
540 assumed that the values of \var{arg1} are constant for all
541 components. \var{arg1} must be defined in the same \FunctionSpace as
542 \var{arg0} or it must be possible to interpolate \var{arg1} onto the
543 \FunctionSpace of \var{arg0}.
544
545 The \Data class supports taking slices from a \Data object as well as assigning new values to a slice of an existing
546 \Data object. \index{slicing}
547 The following expressions for taking and setting slices are valid:
548 \begin{tableiii}{l|ll}{textrm}{rank of \var{arg}}{slicing expression}{\Shape of returned and assigned object}
549 \lineiii{0}{ no slicing } {-}
550 \lineiii{1}{\var{arg[l0:u0]}} {(\var{u0}-\var{l0},)}
551 \lineiii{2}{\var{arg[l0:u0,l1:u1]}} {(\var{u0}-\var{l0},\var{u1}-\var{l1})}
552 \lineiii{3}{\var{arg[l0:u0,l1:u1,l2:u2]} } {(\var{u0}-\var{l0},\var{u1}-\var{l1},\var{u2}-\var{l2})}
553 \lineiii{4}{\var{arg[l0:u0,l1:u1,l2:u2,l3:u3]}} {(\var{u0}-\var{l0},\var{u1}-\var{l1},\var{u2}-\var{l2},\var{u3}-\var{l3})}
554 \end{tableiii}
555 where \var{s} is the \Shape of \var{arg} and
556 \[0 \le \var{l0} \le \var{u0} \le \var{s[0]},\]
557 \[0 \le \var{l1} \le \var{u1} \le \var{s[1]},\]
558 \[0 \le \var{l2} \le \var{u2} \le \var{s[2]},\]
559 \[0 \le \var{l3} \le \var{u3} \le \var{s[3]}.\]
560 Any of the lower indexes \var{l0}, \var{l1}, \var{l2} and \var{l3} may not be present in which case
561 $0$ is assumed.
562 Any of the upper indexes \var{u0}, \var{u1}, \var{u2} and \var{u3} may be omitted, in which case, the upper limit for that dimension is assumed.
563 The lower and upper index may be identical, in which case the column and the lower or upper
564 index may be dropped. In the returned or in the object assigned to a slice, the corresponding component is dropped,
565 i.e. the rank is reduced by one in comparison to \var{arg}.
566 The following examples show slicing in action:
567 \begin{python}
568 t=Data(1.,(4,4,6,6),Function(mydomain))
569 t[1,1,1,0]=9.
570 s=t[:2,:,2:6,5] # s has rank 3
571 s[:,:,1]=1.
572 t[:2,:2,5,5]=s[2:4,1,:2]
573 \end{python}
574
575 \subsection{Generation of \Data objects}
576 \begin{classdesc}{Data}{value=0,shape=(,),what=FunctionSpace(),expand=\False}
577 creates a \Data object with \Shape \var{shape} in the \FunctionSpace \var{what}.
578 The values at all \DataSamplePoints are set to the double value \var{value}. If \var{expanded} is \True
579 the \Data object is represented in expanded from.
580 \end{classdesc}
581
582 \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False}
583 creates a \Data object in the \FunctionSpace \var{what}.
584 The value for each \DataSamplePoints is set to \var{value}, which could be a \numpy, \Data object \var{value} or a dictionary of
585 \numpy or floating point numbers. In the latter case the keys must be integers and are used
586 as tags.
587 The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True
588 the \Data object is represented in expanded form.
589 \end{classdesc}
590
591 \begin{classdesc}{Data}{}
592 creates an \EmptyData object. The \EmptyData object is used to indicate that an argument is not present
593 where a \Data object is required.
594 \end{classdesc}
595
596 \begin{funcdesc}{Scalar}{value=0.,what=FunctionSpace(),expand=\False}
597 returns a \Data object of rank 0 (a constant) in the \FunctionSpace \var{what}.
598 Values are initialized with \var{value}, a double precision quantity. If \var{expanded} is \True
599 the \Data object is represented in expanded from.
600 \end{funcdesc}
601
602 \begin{funcdesc}{Vector}{value=0.,what=FunctionSpace(),expand=\False}
603 returns a \Data object of \Shape \var{(d,)} in the \FunctionSpace \var{what},
604 where \var{d} is the spatial dimension of the \Domain of \var{what}.
605 Values are initialed with \var{value}, a double precision quantity. If \var{expanded} is \True
606 the \Data object is represented in expanded from.
607 \end{funcdesc}
608
609 \begin{funcdesc}{Tensor}{value=0.,what=FunctionSpace(),expand=\False}
610 returns a \Data object of \Shape \var{(d,d)} in the \FunctionSpace \var{what},
611 where \var{d} is the spatial dimension of the \Domain of \var{what}.
612 Values are initialed with \var{value}, a double precision quantity. If \var{expanded} is \True
613 the \Data object is represented in expanded from.
614 \end{funcdesc}
615
616 \begin{funcdesc}{Tensor3}{value=0.,what=FunctionSpace(),expand=\False}
617 returns a \Data object of \Shape \var{(d,d,d)} in the \FunctionSpace \var{what},
618 where \var{d} is the spatial dimension of the \Domain of \var{what}.
619 Values are initialed with \var{value}, a double precision quantity. If \var{expanded} is \True
620 the \Data object is re\var{arg}presented in expanded from.
621 \end{funcdesc}
622
623 \begin{funcdesc}{Tensor4}{value=0.,what=FunctionSpace(),expand=\False}
624 returns a \Data object of \Shape \var{(d,d,d,d)} in the \FunctionSpace \var{what},
625 where \var{d} is the spatial dimension of the \Domain of \var{what}.
626 Values are initialized with \var{value}, a double precision quantity. If \var{expanded} is \True
627 the \Data object is represented in expanded from.
628 \end{funcdesc}
629
630 \begin{funcdesc}{load}{filename,domain}
631 recovers a \Data object on \Domain \var{domain} from the file \var{filename}, which was created by \function{dump}.
632 \end{funcdesc}
633
634 \subsection{\Data methods}
635 These are the most frequently-used methods of the
636 \Data class. A complete list of methods can be found on \ReferenceGuide.
637 \begin{methoddesc}[Data]{getFunctionSpace}{}
638 returns the \FunctionSpace of the object.
639 \end{methoddesc}
640
641 \begin{methoddesc}[Data]{getDomain}{}
642 returns the \Domain of the object.
643 \end{methoddesc}
644
645 \begin{methoddesc}[Data]{getShape}{}
646 returns the \Shape of the object as a \class{tuple} of
647 integers.
648 \end{methoddesc}
649
650 \begin{methoddesc}[Data]{getRank}{}
651 returns the rank of the data on each data point. \index{rank}
652 \end{methoddesc}
653
654 \begin{methoddesc}[Data]{isEmpty}{}
655 returns \True id the \Data object is the \EmptyData object.
656 Otherwise \False is returned.
657 Note that this is not the same as asking if the object contains no \DataSamplePoints.
658 \end{methoddesc}
659
660 \begin{methoddesc}[Data]{setTaggedValue}{tag_name,value}
661 assigns the \var{value} to all \DataSamplePoints which have the tag
662 assigned to \var{tag_name}. \var{value} must be an object of class
663 \class{numpy.ndarray} or must be convertible into a
664 \class{numpy.ndarray} object. \var{value} (or the corresponding
665 \class{numpy.ndarray} object) must be of rank $0$ or must have the
666 same rank like the object.
667 If a value has already be defined for tag \var{tag_name} within the object
668 it is overwritten by the new \var{value}. If the object is expanded,
669 the value assigned to \DataSamplePoints with tag \var{tag_name} is replaced by
670 \var{value}. If no tag is assigned tag name \var{tag_name}, no value is set.
671 \end{methoddesc}
672
673 \begin{methoddesc}[Data]{dump}{filename}
674 dumps the \Data object to the file \var{filename}. The file stores the
675 function space but not the \Domain. It is in the responsibility of the user to
676 save the \Domain.
677 \end{methoddesc}
678
679 \begin{methoddesc}[Data]{__str__}{}
680 returns a string representation of the object.
681 \end{methoddesc}
682
683 \subsection{Functions of \Data objects}
684 This section lists the most important functions for \Data class objects \var{a}.
685 A complete list and a more detailed description of the functionality can be found on \ReferenceGuide.
686 \begin{funcdesc}{saveVTK}{filename,**kwdata}
687 writes \Data defined by keywords in the file with \var{filename} using the
688 vtk file format \VTK file format. The key word is used as an identifier. The statement
689 \begin{python}
690 saveVTK("out.xml",temperature=T,velocity=v)
691 \end{python}
692 will write the scalar \var{T} as \var{temperature} and the vector \var{v} as \var{velocity} into the
693 file \file{out.xml}. Restrictions on the allowed combinations of \FunctionSpace apply.
694 \end{funcdesc}
695 \begin{funcdesc}{saveDX}{filename,**kwdata}
696 writes \Data defined by keywords in the file with \var{filename} using the
697 vtk file format \OpenDX file format. The key word is used as an identifier. The statement
698 \begin{python}
699 saveDX("out.dx",temperature=T,velocity=v)
700 \end{python}
701 will write the scalar \var{T} as \var{temperature} and the vector \var{v} as \var{velocity} into the
702 file \file{out.dx}. Restrictions on the allowed combinations of \FunctionSpace apply.
703 \end{funcdesc}
704 \begin{funcdesc}{kronecker}{d}
705 returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
706 \begin{equation}
707 \code{kronecker(d)}\left[ i,j\right] = \left\{
708 \begin{array}{cc}
709 1 & \mbox{ if } i=j \\
710 0 & \mbox{ otherwise }
711 \end{array}
712 \right.
713 \end{equation}
714 If \var{d} is an integer a $(d,d)$ \numpy array is returned.
715 \end{funcdesc}
716 \begin{funcdesc}{identityTensor}{d}
717 is a synonym for \code{kronecker} (see above).
718 % returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
719 % \begin{equation}
720 % \code{identityTensor(d)}\left[ i,j\right] = \left\{
721 % \begin{array}{cc}
722 % 1 & \mbox{ if } i=j \\
723 % 0 & \mbox{ otherwise }
724 % \end{array}
725 % \right.
726 % \end{equation}
727 % If \var{d} is an integer a $(d,d)$ \numpy array is returned.
728 \end{funcdesc}
729 \begin{funcdesc}{identityTensor4}{d}
730 returns a \RankFour \Data object in \FunctionSpace \var{d} such that
731 \begin{equation}
732 \code{identityTensor(d)}\left[ i,j,k,l\right] = \left\{
733 \begin{array}{cc}
734 1 & \mbox{ if } i=k \mbox{ and } j=l\\
735 0 & \mbox{ otherwise }
736 \end{array}
737 \right.
738 \end{equation}
739 If \var{d} is an integer a $(d,d,d,d)$ \numpy array is returned.
740 \end{funcdesc}
741 \begin{funcdesc}{unitVector}{i,d}
742 returns a \RankOne \Data object in \FunctionSpace \var{d} such that
743 \begin{equation}
744 \code{identityTensor(d)}\left[ j \right] = \left\{
745 \begin{array}{cc}
746 1 & \mbox{ if } j=i\\
747 0 & \mbox{ otherwise }
748 \end{array}
749 \right.
750 \end{equation}
751 If \var{d} is an integer a $(d,)$ \numpy array is returned.
752
753 \end{funcdesc}
754
755 \begin{funcdesc}{Lsup}{a}
756 returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values
757 over all components and all \DataSamplePoints of \var{a}.
758 \end{funcdesc}
759
760 \begin{funcdesc}{sup}{a}
761 returns the maximum value over all components and all \DataSamplePoints of \var{a}.
762 \end{funcdesc}
763
764 \begin{funcdesc}{inf}{a}
765 returns the minimum value over all components and all \DataSamplePoints of \var{a}
766 \end{funcdesc}
767
768
769
770 \begin{funcdesc}{minval}{a}
771 returns at each \DataSamplePoints the minimum value over all components.
772 \end{funcdesc}
773
774 \begin{funcdesc}{maxval}{a}
775 returns at each \DataSamplePoints the maximum value over all components.
776 \end{funcdesc}
777
778 \begin{funcdesc}{length}{a}
779 returns at Euclidean norm at each \DataSamplePoints. For a \RankFour \var{a} this is
780 \begin{equation}
781 \code{length(a)}=\sqrt{\sum\hackscore{ijkl} \var{a} \left[i,j,k,l\right]^2}
782 \end{equation}
783 \end{funcdesc}
784 \begin{funcdesc}{trace}{a\optional{,axis_offset=0}}
785 returns the trace of \var{a}. This is the sum over components \var{axis_offset} and \var{axis_offset+1} with the same index. For instance in the
786 case of a \RankTwo function and this is
787 \begin{equation}
788 \code{trace(a)}=\sum\hackscore{i} \var{a} \left[i,i\right]
789 \end{equation}
790 and for a \RankFour function and \code{axis_offset=1} this is
791 \begin{equation}
792 \code{trace(a,1)}\left[i,j\right]=\sum\hackscore{k} \var{a} \left[i,k,k,j\right]
793 \end{equation}
794 \end{funcdesc}
795
796 \begin{funcdesc}{transpose}{a\optional{, axis_offset=None}}
797 returns the transpose of \var{a}. This swaps the first \var{axis_offset} components of \var{a} with the rest. If \var{axis_offset} is not
798 present \code{int(r/2)} is used where \var{r} is the rank of \var{a}.
799 the sum over components \var{axis_offset} and \var{axis_offset+1} with the same index. For instance in the
800 case of a \RankTwo function and this is
801 \begin{equation}
802 \code{transpose(a)}\left[i,j\right]=\var{a} \left[j,i\right]
803 \end{equation}
804 and for a \RankFour function and \code{axis_offset=1} this is
805 \begin{equation}
806 \code{transpose(a,1)}\left[i,j,k,l\right]=\var{a} \left[j,k,l,i\right]
807 \end{equation}
808 \end{funcdesc}
809
810 \begin{funcdesc}{swap_axes}{a\optional{, axis0=0 \optional{, axis1=1 }}}
811 returns \var{a} but with swapped components \var{axis0} and \var{axis1}. The argument \var{a} must be
812 at least of \RankTwo. For instance in the
813 for a \RankFour argument, \code{axis0=1} and \code{axis1=2} this is
814 \begin{equation}
815 \code{swap_axes(a,1,2)}\left[i,j,k,l\right]=\var{a} \left[i,k,j,l\right]
816 \end{equation}
817 \end{funcdesc}
818
819 \begin{funcdesc}{symmetric}{a}
820 returns the symmetric part of \var{a}. This is \code{(a+transpose(a))/2}.
821 \end{funcdesc}
822 \begin{funcdesc}{nonsymmetric}{a}
823 returns the non--symmetric part of \var{a}. This is \code{(a-transpose(a))/2}.
824 \end{funcdesc}
825 \begin{funcdesc}{inverse}{a}
826 return the inverse of \var{a}. This is
827 \begin{equation}
828 \code{matrix_mult(inverse(a),a)=kronecker(d)}
829 \end{equation}
830 if \var{a} has shape \code{(d,d)}. The current implementation is restricted to arguments of shape
831 \code{(2,2)} and \code{(3,3)}.
832 \end{funcdesc}
833 \begin{funcdesc}{eigenvalues}{a}
834 return the eigenvalues of \var{a}. This is
835 \begin{equation}
836 \code{matrix_mult(a,V)=e[i]*V}
837 \end{equation}
838 where \code{e=eigenvalues(a)} and \var{V} is suitable non--zero vector \var{V}.
839 The eigenvalues are ordered in increasing size.
840 The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.
841 The current implementation is restricted to arguments of shape
842 \code{(2,2)} and \code{(3,3)}.
843 \end{funcdesc}
844 \begin{funcdesc}{eigenvalues_and_eigenvectors}{a}
845 return the eigenvalues and eigenvectors of \var{a}. This is
846 \begin{equation}
847 \code{matrix_mult(a,V[:,i])=e[i]*V[:,i]}
848 \end{equation}
849 where \code{e,V=eigenvalues_and_eigenvectors(a)}. The eigenvectors \var{V} are orthogonal and normalized, ie.
850 \begin{equation}
851 \code{matrix_mult(transpose(V),V)=kronecker(d)}
852 \end{equation}
853 if \var{a} has shape \code{(d,d)}. The eigenvalues are ordered in increasing size.
854 The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.
855 The current implementation is restricted to arguments of shape
856 \code{(2,2)} and \code{(3,3)}.
857 \end{funcdesc}
858 \begin{funcdesc}{maximum}{*a}
859 returns the maximum value over all arguments at all \DataSamplePoints and for each component.
860 For instance
861 \begin{equation}
862 \code{maximum(a0,a1)}\left[i,j\right]=max(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
863 \end{equation}
864 at all \DataSamplePoints.
865 \end{funcdesc}
866 \begin{funcdesc}{minimum}{*a}
867 returns the minimum value over all arguments at all \DataSamplePoints and for each component.
868 For instance
869 \begin{equation}
870 \code{minimum(a0,a1)}\left[i,j\right]=min(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
871 \end{equation}
872 at all \DataSamplePoints.
873 \end{funcdesc}
874
875 \begin{funcdesc}{clip}{a\optional{, minval=0.}\optional{, maxval=1.}}
876 cuts back \var{a} into the range between \var{minval} and \var{maxval}. A value in the returned object equals
877 \var{minval} if the corresponding value of \var{a} is less than \var{minval}, equals \var{maxval} if the
878 corresponding value of \var{a} is greater than \var{maxval}
879 or corresponding value of \var{a} otherwise.
880 \end{funcdesc}
881 \begin{funcdesc}{inner}{a0,a1}
882 returns the inner product of \var{a0} and \var{a1}. For instance in the
883 case of \RankTwo arguments and this is
884 \begin{equation}
885 \code{inner(a)}=\sum\hackscore{ij}\var{a0} \left[j,i\right] \cdot \var{a1} \left[j,i\right]
886 \end{equation}
887 and for a \RankFour arguments this is
888 \begin{equation}
889 \code{inner(a)}=\sum\hackscore{ijkl}\var{a0} \left[i,j,k,l\right] \cdot \var{a1} \left[j,i,k,l\right]
890 \end{equation}
891 \end{funcdesc}
892
893 \begin{funcdesc}{matrix_mult}{a0,a1}
894 returns the matrix product of \var{a0} and \var{a1}. If \var{a1} is \RankOne this is
895 \begin{equation}
896 \code{matrix_mult(a)}\left[i\right]=\sum\hackscore{k}\var{a0} \cdot \left[i,k\right]\var{a1} \left[k\right]
897 \end{equation}
898 and if \var{a1} is \RankTwo this is
899 \begin{equation}
900 \code{matrix_mult(a)}\left[i,j\right]=\sum\hackscore{k}\var{a0} \cdot \left[i,k\right]\var{a1} \left[k,j\right]
901 \end{equation}
902 \end{funcdesc}
903
904 \begin{funcdesc}{transposed_matrix_mult}{a0,a1}
905 returns the matrix product of the transposed of \var{a0} and \var{a1}. The function is equivalent to
906 \code{matrix_mult(transpose(a0),a1)}.
907 If \var{a1} is \RankOne this is
908 \begin{equation}
909 \code{transposed_matrix_mult(a)}\left[i\right]=\sum\hackscore{k}\var{a0} \cdot \left[k,i\right]\var{a1} \left[k\right]
910 \end{equation}
911 and if \var{a1} is \RankTwo this is
912 \begin{equation}
913 \code{transposed_matrix_mult(a)}\left[i,j\right]=\sum\hackscore{k}\var{a0} \cdot \left[k,i\right]\var{a1} \left[k,j\right]
914 \end{equation}
915 \end{funcdesc}
916
917 \begin{funcdesc}{matrix_transposed_mult}{a0,a1}
918 returns the matrix product of \var{a0} and the transposed of \var{a1}.
919 The function is equivalent to
920 \code{matrix_mult(a0,transpose(a1))}.
921 If \var{a1} is \RankTwo this is
922 \begin{equation}
923 \code{matrix_transposed_mult(a)}\left[i,j\right]=\sum\hackscore{k}\var{a0} \cdot \left[i,k\right]\var{a1} \left[j,k\right]
924 \end{equation}
925 \end{funcdesc}
926
927 \begin{funcdesc}{outer}{a0,a1}
928 returns the outer product of \var{a0} and \var{a1}. For instance if \var{a0} and \var{a1} both are \RankOne then
929 \begin{equation}
930 \code{outer(a)}\left[i,j\right]=\var{a0} \left[i\right] \cdot \var{a1}\left[j\right]
931 \end{equation}
932 and if \var{a0} is \RankOne and \var{a1} is \RankThree
933 \begin{equation}
934 \code{outer(a)}\left[i,j,k\right]=\var{a0} \left[i\right] \cdot \var{a1}\left[j,k\right]
935 \end{equation}
936 \end{funcdesc}
937
938 \begin{funcdesc}{tensor_mult}{a0,a1}
939 returns the tensor product of \var{a0} and \var{a1}. If \var{a1} is \RankTwo this is
940 \begin{equation}
941 \code{tensor_mult(a)}\left[i,j\right]=\sum\hackscore{kl}\var{a0}\left[i,j,k,l\right] \cdot \var{a1} \left[k,l\right]
942 \end{equation}
943 and if \var{a1} is \RankFour this is
944 \begin{equation}
945 \code{tensor_mult(a)}\left[i,j,k,l\right]=\sum\hackscore{mn}\var{a0} \left[i,j,m,n\right] \cdot \var{a1} \left[m,n,k,l\right]
946 \end{equation}
947 \end{funcdesc}
948
949 \begin{funcdesc}{transposed_tensor_mult}{a0,a1}
950 returns the tensor product of the transposed of \var{a0} and \var{a1}. The function is equivalent to
951 \code{tensor_mult(transpose(a0),a1)}.
952 If \var{a1} is \RankTwo this is
953 \begin{equation}
954 \code{transposed_tensor_mult(a)}\left[i,j\right]=\sum\hackscore{kl}\var{a0}\left[k,l,i,j\right] \cdot \var{a1} \left[k,l\right]
955 \end{equation}
956 and if \var{a1} is \RankFour this is
957 \begin{equation}
958 \code{transposed_tensor_mult(a)}\left[i,j,k,l\right]=\sum\hackscore{mn}\var{a0} \left[m,n,i,j\right] \cdot \var{a1} \left[m,n,k,l\right]
959 \end{equation}
960 \end{funcdesc}
961
962 \begin{funcdesc}{tensor_transposed_mult}{a0,a1}
963 returns the tensor product of \var{a0} and the transposed of \var{a1}.
964 The function is equivalent to
965 \code{tensor_mult(a0,transpose(a1))}.
966 If \var{a1} is \RankTwo this is
967 \begin{equation}
968 \code{tensor_transposed_mult(a)}\left[i,j\right]=\sum\hackscore{kl}\var{a0}\left[i,j,k,l\right] \cdot \var{a1} \left[l,k\right]
969 \end{equation}
970 and if \var{a1} is \RankFour this is
971 \begin{equation}
972 \code{tensor_transposed_mult(a)}\left[i,j,k,l\right]=\sum\hackscore{mn}\var{a0} \left[i,j,m,n\right] \cdot \var{a1} \left[k,l,m,n\right]
973 \end{equation}
974 \end{funcdesc}
975
976 \begin{funcdesc}{grad}{a\optional{, where=None}}
977 returns the gradient of \var{a}. If \var{where} is present the gradient will be calculated in \FunctionSpace \var{where} otherwise a
978 default \FunctionSpace is used. In case that \var{a} has \RankTwo one has
979 \begin{equation}
980 \code{grad(a)}\left[i,j,k\right]=\frac{\partial \var{a} \left[i,j\right]}{\partial x\hackscore{k}}
981 \end{equation}
982 \end{funcdesc}
983 \begin{funcdesc}{integrate}{a\optional{ ,where=None}}
984 returns the integral of \var{a} where the domain of integration is defined by the \FunctionSpace of \var{a}. If \var{where} is
985 present the argument is interpolated into \FunctionSpace \var{where} before integration. For instance in the case of
986 a \RankTwo argument in \ContinuousFunction it is
987 \begin{equation}
988 \code{integrate(a)}\left[i,j\right]=\int\hackscore{\Omega}\var{a} \left[i,j\right] \; d\Omega
989 \end{equation}
990 where $\Omega$ is the spatial domain and $d\Omega$ volume integration. To integrate over the boundary of the domain one uses
991 \begin{equation}
992 \code{integrate(a,where=FunctionOnBoundary(a.getDomain))}\left[i,j\right]=\int\hackscore{\partial \Omega} a\left[i,j\right] \; ds
993 \end{equation}
994 where $\partial \Omega$ is the surface of the spatial domain and $ds$ area or line integration.
995 \end{funcdesc}
996 \begin{funcdesc}{interpolate}{a,where}
997 interpolates argument \var{a} into the \FunctionSpace \var{where}.
998 \end{funcdesc}
999 \begin{funcdesc}{div}{a\optional{ ,where=None}}
1000 returns the divergence of \var{a}. This
1001 \begin{equation}
1002 \code{div(a)}=trace(grad(a),where)
1003 \end{equation}
1004 \end{funcdesc}
1005 \begin{funcdesc}{jump}{a\optional{ ,domain=None}}
1006 returns the jump of \var{a} over the discontinuity in its domain or if \Domain \var{domain} is present
1007 in \var{domain}.
1008 \begin{equation}
1009 \begin{array}{rcl}
1010 \code{jump(a)}& = &\code{interpolate(a,FunctionOnContactOne(domain))} \\
1011 & & \hfill - \code{interpolate(a,FunctionOnContactZero(domain))}
1012 \end{array}
1013 \end{equation}
1014 \end{funcdesc}
1015 \begin{funcdesc}{L2}{a}
1016 returns the $L^2$-norm of \var{a} in its function space. This is
1017 \begin{equation}
1018 \code{L2(a)=integrate(length(a)}^2\code{)} \; .
1019 \end{equation}
1020 \end{funcdesc}
1021
1022 The following functions operate ``point-wise''. That is, the operation is applied to each component of each point
1023 individually.
1024
1025 \begin{funcdesc}{sin}{a}
1026 applies sine function to \var{a}.
1027 \end{funcdesc}
1028
1029 \begin{funcdesc}{cos}{a}
1030 applies cosine function to \var{a}.
1031 \end{funcdesc}
1032
1033 \begin{funcdesc}{tan}{a}
1034 applies tangent function to \var{a}.
1035 \end{funcdesc}
1036
1037 \begin{funcdesc}{asin}{a}
1038 applies arc (inverse) sine function to \var{a}.
1039 \end{funcdesc}
1040
1041 \begin{funcdesc}{acos}{a}
1042 applies arc (inverse) cosine function to \var{a}.
1043 \end{funcdesc}
1044
1045 \begin{funcdesc}{atan}{a}
1046 applies arc (inverse) tangent function to \var{a}.
1047 \end{funcdesc}
1048
1049 \begin{funcdesc}{sinh}{a}
1050 applies hyperbolic sine function to \var{a}.
1051 \end{funcdesc}
1052
1053 \begin{funcdesc}{cosh}{a}
1054 applies hyperbolic cosine function to \var{a}.
1055 \end{funcdesc}
1056
1057 \begin{funcdesc}{tanh}{a}
1058 applies hyperbolic tangent function to \var{a}.
1059 \end{funcdesc}
1060
1061 \begin{funcdesc}{asinh}{a}
1062 applies arc (inverse) hyperbolic sine function to \var{a}.
1063 \end{funcdesc}
1064
1065 \begin{funcdesc}{acosh}{a}
1066 applies arc (inverse) hyperbolic cosine function to \var{a}.
1067 \end{funcdesc}
1068
1069 \begin{funcdesc}{atanh}{a}
1070 applies arc (inverse) hyperbolic tangent function to \var{a}.
1071 \end{funcdesc}
1072
1073 \begin{funcdesc}{exp}{a}
1074 applies exponential function to \var{a}.
1075 \end{funcdesc}
1076
1077 \begin{funcdesc}{sqrt}{a}
1078 applies square root function to \var{a}.
1079 \end{funcdesc}
1080
1081 \begin{funcdesc}{log}{a}
1082 applies the natural logarithm to \var{a}.
1083 \end{funcdesc}
1084
1085 \begin{funcdesc}{log10}{a}
1086 applies the base-$10$ logarithm to \var{a}.
1087 \end{funcdesc}
1088
1089 \begin{funcdesc}{sign}{a}
1090 applies the sign function to \var{a}, that is $1$ where \var{a} is positive,
1091 $-1$ where \var{a} is negative and $0$ otherwise.
1092 \end{funcdesc}
1093
1094 \begin{funcdesc}{wherePositive}{a}
1095 returns a function which is $1$ where \var{a} is positive and $0$ otherwise.
1096 \end{funcdesc}
1097
1098 \begin{funcdesc}{whereNegative}{a}
1099 returns a function which is $1$ where \var{a} is negative and $0$ otherwise.
1100 \end{funcdesc}
1101
1102 \begin{funcdesc}{whereNonNegative}{a}
1103 returns a function which is $1$ where \var{a} is non--negative and $0$ otherwise.
1104 \end{funcdesc}
1105
1106 \begin{funcdesc}{whereNonPositive}{a}
1107 returns a function which is $1$ where \var{a} is non--positive and $0$ otherwise.
1108 \end{funcdesc}
1109
1110 \begin{funcdesc}{whereZero}{a\optional{, tol=None, \optional{, rtol=1.e-8}}}
1111 returns a function which is $1$ where \var{a} equals zero with tolerance \var{tol} and $0$ otherwise. If \var{tol} is not present, the absolute maximum value of C{a} times C{rtol} is used.
1112 \end{funcdesc}
1113
1114 \begin{funcdesc}{whereNonZero}{a, \optional{, tol=None, \optional{, rtol=1.e-8}}}
1115 returns a function which is $1$ where \var{a} different from zero with tolerance \var{tol} and $0$ otherwise. If \var{tol} is not present, the absolute maximum value of C{a} times C{rtol} is used.
1116 \end{funcdesc}
1117
1118 \subsection{Interpolating Data}
1119 \index{interpolateTable}
1120 In some cases, it may be useful to produce Data objects which fit some user defined function.
1121 Manually modifying each value in the Data object is not a good idea since it depends on
1122 knowing the location and order of each datapoint in the domain.
1123 Instead \escript can use an interpolation table to produce a Data object.
1124
1125 The following example is available as \file{int_save.py} in the examples directory.
1126 We will produce a \Data object which aproximates a sine curve.
1127
1128 \begin{python}
1129 from esys.escript import saveDataCSV, sup
1130 import numpy
1131 from esys.finley import Rectangle
1132
1133 n=4
1134 r=Rectangle(n,n)
1135 x=r.getX()
1136 x0=x[0]
1137 x1=x[1] #we'll use this later
1138 toobig=100
1139 \end{python}
1140
1141 First we produce an interpolation table.
1142 \begin{python}
1143 sine_table=[0, 0.70710678118654746, 1, 0.70710678118654746, 0,
1144 -0.70710678118654746, -1, -0.70710678118654746, 0]
1145 \end{python}
1146
1147 We wish to identify $0$ and $1$ with the ends of the curve.
1148 That is, with the first and eighth values in the table.
1149
1150 \begin{python}
1151 numslices=len(sine_table)-1
1152
1153 minval=0
1154 maxval=1
1155
1156 step=sup(maxval-minval)/numslices
1157 \end{python}
1158
1159 So the values $v$ from the input lie in the interval minval$\leq v < $maxval.
1160 \var{step} represents the gap (in the input range) between entries in the table.
1161 By default values of $v$ outside the table argument range (minval, maxval) will
1162 be pushed back into the range, ie. if $v <$ minval the value minval will be used to
1163 evaluate the table. Similarly, for values $v>$ maxval the value maxval is used.
1164
1165 Now we produce our new \Data object.
1166
1167 \begin{python}
1168 result=x0.interpolateTable(sine_table, minval, step, toobig)
1169 \end{python}
1170 Any values which interpolate to larger than \var{toobig} will raise an exception. You can
1171 switch on boundary checking by adding ''check_boundaries=True`` the argument list.
1172
1173
1174 Now for a 2D example.
1175 We will interpolate a surface such that the bottom edge is the sine curve described above.
1176 The amplitude of the curve decreases as we move towards the top edge.
1177
1178 Our interpolation table will have three rows.
1179 \begin{python}
1180 st=numpy.array(sine_table)
1181
1182 table=[st, 0.5*st, 0*st ]
1183 \end{python}
1184
1185 The use of numpy and multiplication here is just to save typing.
1186
1187 \begin{python}
1188 result2=x1.interpolateTable(table, 0, 0.55, x0, minval, step, toobig)
1189 \end{python}
1190
1191 In the 2D case, the parameters for the x1 direction (min=0, step=0.55) come first followed by the x0 data object and
1192 its parameters.
1193 By default, if a point is specified which is outside the boundary, then \var{interpolateTable} will operate
1194 as if the point was on the boundary.
1195 Passing \var{check_boundaries}=\var{True} will \var{interpolateTable} to reject any points outside the boundaries.
1196
1197 \subsection{Saving Data as CSV}
1198 \index{saveDataCSV}
1199 \index{CSV}
1200 For simple post-processing, \Data objects can be saved in comma separated value format.
1201
1202 If \var{mydata1} and \var{mydata2} are scalar data, the following command:
1203 \begin{python}
1204 saveDataCSV('output.csv',U=mydata1, V=mydata2)
1205 \end{python}
1206 will record the values of mydata in \texttt{output.csv} in the following format:
1207 \begin{verbatim}
1208 U, V
1209 1.0000000e+0, 2.0000000e-1
1210 5.0000000e-0, 1.0000000e+1
1211 ...
1212 \end{verbatim}
1213
1214 The names of the keyword parameters form the names of columns in the output.
1215 If the data objects are over different function spaces, then saveDataCSV will attempt to
1216 interpolate to a common function space.
1217 If this is not possible, then an exception will be raised.
1218
1219 Output can be restricted using a scalar mask.
1220 \begin{python}
1221 saveDataCSV('outfile.csv', U=mydata1, V=mydata2, mask=myscalar)
1222 \end{python}
1223 Will only output those rows which correspond to to positive values of \var{myscalar}.
1224 Some aspects of the output can be tuned using additional parameters.
1225 \begin{python}
1226 saveDataCSV('data.csv', append=True, sep=' ', csep='/', mask=mymask, e=mat1)
1227 \end{python}
1228
1229 \begin{itemize}
1230 \item \var{append} - specifies that the output should be written to the end of an existing file.
1231 \item \var{sep} - defines the separator between fields.
1232 \item \var{csep} - defines the separator between components in the header line. For example between the components of a matrix.
1233 \end{itemize}
1234
1235 The above command would produce output like this:
1236 \begin{verbatim}
1237 e/0/0 e/1/0 e/0/1 e/1/1
1238 1.0000000000e+00 2.0000000000e+00 3.0000000000e+00 4.0000000000e+00
1239 ...
1240 \end{verbatim}
1241
1242 Note that while the order in which rows are output can vary, all the elements in a given row
1243 always correspond to the same input.
1244
1245
1246 \subsection{\Operator Class}
1247 The \Operator class provides an abstract access to operators build
1248 within the \LinearPDE class. \Operator objects are created
1249 when a PDE is handed over to a PDE solver library and handled
1250 by the \LinearPDE object defining the PDE. The user can gain access
1251 to the \Operator of a \LinearPDE object through the \var{getOperator}
1252 method.
1253
1254 \begin{classdesc}{Operator}{}
1255 creates an empty \Operator object.
1256 \end{classdesc}
1257
1258 \begin{methoddesc}[Operator]{isEmpty}{fileName}
1259 returns \True is the object is empty. Otherwise \True is returned.
1260 \end{methoddesc}
1261
1262 \begin{methoddesc}[Operator]{setValue}{value}
1263 resets all entries in the object representation to \var{value}
1264 \end{methoddesc}
1265
1266 \begin{methoddesc}[Operator]{solves}{rhs}
1267 solves the operator equation with right hand side \var{rhs}
1268 \end{methoddesc}
1269
1270 \begin{methoddesc}[Operator]{of}{u}
1271 applies the operator to the \Data object \var{u}
1272 \end{methoddesc}
1273
1274 \begin{methoddesc}[Operator]{saveMM}{fileName}
1275 saves the object to a matrix market format file of name
1276 \var{fileName}, see
1277 \url{http://maths.nist.gov/MatrixMarket}
1278 % \ulink{maths.nist.gov/MatrixMarket}{\url{http://maths.nist.gov/MatrixMarket}}.
1279 \index{Matrix Market}
1280 \end{methoddesc}
1281
1282 \section{Physical Units}
1283 \escript provides support for physical units in the SI system \index{SI units} including unit conversion. So the
1284 user can define variables in the form
1285 \begin{python}
1286 from esys.escript.unitsSI import *
1287 l=20*m
1288 w=30*kg
1289 w2=40*lb
1290 T=100*Celsius
1291 \end{python}
1292 In the two latter cases an conversion from pounds\index{pounds} and degree Celsius\index{Celsius} is performed into the appropriate SI units kg and Kelvin is performed. In addition
1293 composed units can be used, for instance
1294 \begin{python}
1295 from esys.escript.unitsSI import *
1296 rho=40*lb/cm**3
1297 \end{python}
1298 to define the density in the units of pounds per cubic centimeter. The value $40$ will be converted
1299 into SI units, in this case kg per cubic meter.
1300 Moreover unit prefixes are supported:
1301 \begin{python}
1302 from esys.escript.unitsSI import *
1303 p=40*Mega*Pa
1304 \end{python}
1305 to the the pressure to 40 Mega Pascal. Units can also be converted back from the SI system into
1306 a desired unit, e.g
1307 \begin{python}
1308 from esys.escript.unitsSI import *
1309 print p/atm
1310 \end{python}
1311 can be used print the pressure in units of atmosphere\index{atmosphere}.
1312
1313 This is an incomplete list of supported physical units:
1314
1315 \begin{datadesc}{km}
1316 unit of kilo meter
1317 \end{datadesc}
1318
1319 \begin{datadesc}{m}
1320 unit of meter
1321 \end{datadesc}
1322
1323 \begin{datadesc}{cm}
1324 unit of centi meter
1325 \end{datadesc}
1326
1327 \begin{datadesc}{mm}
1328 unit of milli meter
1329 \end{datadesc}
1330
1331 \begin{datadesc}{sec}
1332 unit of second
1333 \end{datadesc}
1334
1335 \begin{datadesc}{minute}
1336 unit of minute
1337 \end{datadesc}
1338
1339 \begin{datadesc}{h}
1340 unit of hour
1341 \end{datadesc}
1342 \begin{datadesc}{day}
1343 unit of day
1344 \end{datadesc}
1345 \begin{datadesc}{yr}
1346 unit of year
1347 \end{datadesc}
1348
1349 \begin{datadesc}{gram}
1350 unit of gram
1351 \end{datadesc}
1352 \begin{datadesc}{kg}
1353 unit of kilo gram
1354 \end{datadesc}
1355 \begin{datadesc}{lb}
1356 unit of pound
1357 \end{datadesc}
1358 \begin{datadesc}{ton}
1359 metric ton
1360 \end{datadesc}
1361
1362 \begin{datadesc}{A}
1363 unit of Ampere
1364 \end{datadesc}
1365
1366 \begin{datadesc}{Hz}
1367 unit of Hertz
1368 \end{datadesc}
1369
1370 \begin{datadesc}{N}
1371 unit of Newton
1372 \end{datadesc}
1373 \begin{datadesc}{Pa}
1374 unit of Pascal
1375 \end{datadesc}
1376 \begin{datadesc}{atm}
1377 unit of atmosphere
1378 \end{datadesc}
1379 \begin{datadesc}{J}
1380 unit of Joule
1381 \end{datadesc}
1382
1383 \begin{datadesc}{W}
1384 unit of Watt
1385 \end{datadesc}
1386
1387 \begin{datadesc}{C}
1388 unit of Coulomb
1389 \end{datadesc}
1390 \begin{datadesc}{V}
1391 unit of Volt
1392 \end{datadesc}
1393 \begin{datadesc}{F}
1394 unit of Farad
1395 \end{datadesc}
1396
1397 \begin{datadesc}{Ohm}
1398 unit of Ohm
1399 \end{datadesc}
1400 \begin{datadesc}{K}
1401 unit of Kelvin
1402 \end{datadesc}
1403 \begin{datadesc}{Celsius}
1404 unit of Celsius
1405 \end{datadesc}
1406
1407 \begin{datadesc}{Fahrenheit}
1408 unit of Fahrenheit
1409 \end{datadesc}
1410
1411 Moreover unit prefixes are supported:
1412
1413 \begin{datadesc}{Yotta}
1414 prefix yotta = $10^{24}$.
1415
1416 \end{datadesc}
1417
1418 \begin{datadesc}{Zetta}
1419 prefix zetta= $10^{21}$.
1420 \end{datadesc}
1421
1422 \begin{datadesc}{Exa}
1423 prefix exa= $10^{18}$.
1424 \end{datadesc}
1425
1426 \begin{datadesc}{Peta}
1427 prefix peta= $10^{15}$.
1428 \end{datadesc}
1429
1430 \begin{datadesc}{Tera}
1431 prefix tera= $10^{12}$.
1432 \end{datadesc}
1433
1434 \begin{datadesc}{Giga}
1435 prefix giga= $10^9$.
1436 \end{datadesc}
1437
1438 \begin{datadesc}{Mega}
1439 prefix mega= $10^6$.
1440 \end{datadesc}
1441
1442 \begin{datadesc}{Kilo}
1443 prefix kilo= $10^3$.
1444 \end{datadesc}
1445
1446 \begin{datadesc}{Hecto}
1447 prefix hecto= $10^2$.
1448 \end{datadesc}
1449
1450 \begin{datadesc}{Deca}
1451 prefix deca= $10^1$.
1452 \end{datadesc}
1453
1454 \begin{datadesc}{Deci}
1455 prefix deci= $10^{-1}$.
1456 \end{datadesc}
1457
1458 \begin{datadesc}{Centi}
1459 prefix centi= $10^{-2}$.
1460 \end{datadesc}
1461
1462 \begin{datadesc}{Milli}
1463 prefix milli= $10^{-3}$.
1464 \end{datadesc}
1465
1466 \begin{datadesc}{Micro}
1467 prefix micro= $10^{-6}$.
1468 \end{datadesc}
1469
1470 \begin{datadesc}{Nano}
1471 prefix nano= $10^{-9}$.
1472 \end{datadesc}
1473
1474 \begin{datadesc}{Pico}
1475 prefix pico= $10^{-12}$.
1476 \end{datadesc}
1477
1478 \begin{datadesc}{Femto}
1479 prefix femto= $10^{-15}$.
1480 \end{datadesc}
1481
1482 \begin{datadesc}{Atto}
1483 prefix atto= $10^{-18}$.
1484 \end{datadesc}
1485
1486 \begin{datadesc}{Zepto}
1487 prefix zepto= $10^{-21}$.
1488 \end{datadesc}
1489
1490 \begin{datadesc}{Yocto}
1491 prefix yocto= $10^{-24}$.
1492 \end{datadesc}
1493
1494
1495 \section{Utilities}
1496
1497 The \class{FileWriter} provides a mechanism to write data to a file.
1498 In essence, this class wraps the standard \class{file} class to write data
1499 that are global in MPI to a file. In fact, data are written on the processor
1500 with \MPI rank 0 only. It is recommended to use \class{FileWriter}
1501 rather than \class{open} in order to write code that is running
1502 with and without \MPI. It is save to use \class{open} under MPI to read data which are global under \MPI.
1503
1504 \begin{classdesc}{FileWriter}{fn\optional{,append=\False, \optional{createLocalFiles=\False}})}
1505 Opens a file of name \var{fn} for writing. If \var{append} is set to \True
1506 written data are append at the end of the file.
1507 If running under \MPI only the first processor with rank==0
1508 will open the file and write to it.
1509 If \var{createLocalFiles} is set each individual processor will create a file
1510 where for any processor with rank>0 the file name is extended by its rank. This option is normally used for debug purposes only.
1511 \end{classdesc}
1512
1513 The following methods are available:
1514 \begin{methoddesc}[FileWriter]{close}{}
1515 closes the file.
1516 \end{methoddesc}
1517 \begin{methoddesc}[FileWriter]{flush}{}
1518 flushes the internal buffer to disk.
1519 \end{methoddesc}
1520 \begin{methoddesc}[FileWriter]{write}{txt}
1521 Write string \var{txt} to file.
1522 Note that newline is not added.
1523 \end{methoddesc}
1524 \begin{methoddesc}[FileWriter]{writelines}{txts}
1525 Write the list \var{txts} of strings to the file..
1526 Note that newlines are not added.
1527 This method is equivalent to call write() for each string.
1528 \end{methoddesc}
1529 \begin{memberdesc}[FileWriter]{closed}
1530 \True if file is closed.
1531 \end{memberdesc}
1532 \begin{memberdesc}[FileWriter]{mode}
1533 access mode.
1534 \end{memberdesc}
1535 \begin{memberdesc}[FileWriter]{name}
1536 file name.
1537 \end{memberdesc}
1538 \begin{memberdesc}[FileWriter]{newlines}
1539 line separator
1540 \end{memberdesc}
1541
1542
1543 \begin{funcdesc}{setEscriptParamInt}{name,value}
1544 assigns the integer value \var{value} to the parameter \var{name}.
1545 If \var{name}="TOO_MANY_LINES" conversion of any \Data object to a string switches to a
1546 condensed format if more than \var{value} lines would be created.
1547 \end{funcdesc}
1548
1549 \begin{funcdesc}{getEscriptParamInt}{name}
1550 returns the current value of integer parameter \var{name}.
1551 \end{funcdesc}
1552
1553 \begin{funcdesc}{listEscriptParams}{a}
1554 returns a list of valid parameters and their description.
1555 \end{funcdesc}
1556
1557 \begin{funcdesc}{getMPISizeWorld}{}
1558 returns the number of \MPI processors in use in the \env{MPI_COMM_WORLD} processor group.
1559 If \MPI is not used 1 is returned.
1560 \end{funcdesc}
1561 \begin{funcdesc}{getMPIRankWorld}{}
1562 returns the rank of the process within the \env{MPI_COMM_WORLD} processor group.
1563 If \MPI is not used 0 is returned.
1564 \end{funcdesc}
1565 \begin{funcdesc}{MPIBarrierWorld}{}
1566 performs a barrier synchronization across all processors within \env{MPI_COMM_WORLD}
1567 processor group.
1568 \end{funcdesc}
1569 \begin{funcdesc}{getMPIWorldMax}{a}
1570 returns the maximum value of the integer \var{a} across all
1571 processors within \env{MPI_COMM_WORLD}.
1572 \end{funcdesc}
1573

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26