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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3295 by caltinay, Thu Oct 21 23:18:32 2010 UTC revision 3296 by caltinay, Fri Oct 22 02:53:24 2010 UTC
# Line 43  PDE solutions on the \Domain \var{mydoma Line 43  PDE solutions on the \Domain \var{mydoma
43  \begin{python}  \begin{python}
44    solution_space=Solution(mydomain)    solution_space=Solution(mydomain)
45  \end{python}  \end{python}
46  The following generators for function spaces on a \Domain \var{mydomain} are commonly used:  The following generators for function spaces on a \Domain \var{mydomain} are commonly used:
47  \begin{itemize}  \begin{itemize}
48  \item \var{Solution(mydomain)}: solutions of a PDE  \item \var{Solution(mydomain)}: solutions of a PDE
49  \item \var{ReducedSolution(mydomain)}: solutions of a PDE with a reduced  \item \var{ReducedSolution(mydomain)}: solutions of a PDE with a reduced
# Line 60  In some cases under-integration is used. Line 60  In some cases under-integration is used.
60  \begin{itemize}  \begin{itemize}
61  \item \var{ReducedFunction(mydomain)}  \item \var{ReducedFunction(mydomain)}
62  \item \var{ReducedFunctionOnBoundary(mydomain)}  \item \var{ReducedFunctionOnBoundary(mydomain)}
63  \item \var{ReducedFunctionOnContact0(mydomain)}  \item \var{ReducedFunctionOnContact0(mydomain)}
64  \item \var{ReducedFunctionOnContact1(mydomain)}  \item \var{ReducedFunctionOnContact1(mydomain)}
65  \end{itemize}  \end{itemize}
66  In comparison to the corresponding full version they use a reduced number of  In comparison to the corresponding full version they use a reduced number of
# Line 83  A discontinuity\index{discontinuity} is Line 83  A discontinuity\index{discontinuity} is
83  which functions may be discontinuous.  which functions may be discontinuous.
84  The location of a discontinuity is defined in the \Domain object.  The location of a discontinuity is defined in the \Domain object.
85  \fig{ESCRIPT DEP} shows the dependency between the types of function spaces  \fig{ESCRIPT DEP} shows the dependency between the types of function spaces
86  in \finley (other libraries may have different relationships).  in \finley (other libraries may have different relationships).
87    
88  The solution of a PDE is a continuous function. Any continuous function can  The solution of a PDE is a continuous function. Any continuous function can
89  be seen as a general function on the domain and can be restricted to the  be seen as a general function on the domain and can be restricted to the
# Line 107  but in a finite difference scheme the ed Line 107  but in a finite difference scheme the ed
107  By changing its function space you can use the same function in a Finite  By changing its function space you can use the same function in a Finite
108  Difference scheme instead of Finite Element scheme.  Difference scheme instead of Finite Element scheme.
109  Changing the function space of a particular function will typically lead to  Changing the function space of a particular function will typically lead to
110  a change of its representation.  a change of its representation.
111  So, when seen as a general function, a continuous function which is typically  So, when seen as a general function, a continuous function which is typically
112  represented by its values on the nodes of the FEM mesh or finite difference  represented by its values on the nodes of the FEM mesh or finite difference
113  grid must be interpolated to the element centers or the cell edges,  grid must be interpolated to the element centers or the cell edges,
114  respectively. Interpolation happens automatically in \escript whenever it is  respectively. Interpolation happens automatically in \escript whenever it is
115  required\index{interpolation}. The user needs to be aware that an  required\index{interpolation}. The user needs to be aware that an
116  interpolation is not always possible, see \fig{ESCRIPT DEP} for \finley.  interpolation is not always possible, see \fig{ESCRIPT DEP} for \finley.
117  An alternative approach to change the representation (=\FunctionSpace) is  An alternative approach to change the representation (=\FunctionSpace) is
118  projection\index{projection}, see \Sec{SEC Projection}.  projection\index{projection}, see \Sec{SEC Projection}.
119    
120  \subsection{\Data objects}  \subsection{\Data objects}
121  In \escript the class that stores these functions is called \Data.  In \escript the class that stores these functions is called \Data.
122  The function is represented through its values on \DataSamplePoints where  The function is represented through its values on \DataSamplePoints where
123  the \DataSamplePoints are chosen according to the function space of the  the \DataSamplePoints are chosen according to the function space of the
124  function.    function.
125  \Data class objects are used to define the coefficients of the PDEs to be  \Data class objects are used to define the coefficients of the PDEs to be
126  solved by a PDE solver library and also to store the solutions of the PDE.  solved by a PDE solver library and also to store the solutions of the PDE.
127    
# Line 144  components. Line 144  components.
144    
145  \Data objects can also be created from any \numpy array or any object, such  \Data objects can also be created from any \numpy array or any object, such
146  as a list of floating point numbers, that can be converted into  as a list of floating point numbers, that can be converted into
147  a \numpyNDA\cite{NUMPY}.  a \numpyNDA\cite{NUMPY}.
148  The following two statements create objects which are equivalent  The following two statements create objects which are equivalent
149  to \var{mydat}:  to \var{mydat}:
150  \begin{python}  \begin{python}
# Line 155  In the first case the initial value is \ Line 155  In the first case the initial value is \
155  a $2 \times 3$ matrix as a \numpyNDA filled with ones.  a $2 \times 3$ matrix as a \numpyNDA filled with ones.
156  The \Shape of the created \Data object is taken from the \Shape of the array.  The \Shape of the created \Data object is taken from the \Shape of the array.
157  In the second case, the creator converts the initial value, which is a list of  In the second case, the creator converts the initial value, which is a list of
158  lists, into a \numpyNDA before creating the actual \Data object.        lists, into a \numpyNDA before creating the actual \Data object.
159    
160  For convenience \escript provides creators for the most common types  For convenience \escript provides creators for the most common types
161  of \Data objects in the following forms (\var{d} defines the spatial dimension):  of \Data objects in the following forms (\var{d} defines the spatial dimension):
# Line 187  The following example shows the usage of Line 187  The following example shows the usage of
187  displacement field $u$ and we want to calculate the corresponding stress field  displacement field $u$ and we want to calculate the corresponding stress field
188  $\sigma$ using the linear-elastic isotropic material model  $\sigma$ using the linear-elastic isotropic material model
189  \begin{eqnarray}\label{eq: linear elastic stress}  \begin{eqnarray}\label{eq: linear elastic stress}
190  \sigma\hackscore {ij}=\lambda u\hackscore {k,k} \delta\hackscore {ij} + \mu ( u\hackscore {i,j} + u\hackscore {j,i})  \sigma_{ij}=\lambda u_{k,k} \delta_{ij} + \mu ( u_{i,j} + u_{j,i})
191  \end{eqnarray}  \end{eqnarray}
192  where $\delta\hackscore {ij}$ is the Kronecker symbol and  where $\delta_{ij}$ is the Kronecker symbol and
193  $\lambda$ and $\mu$ are the Lame coefficients. The following function  $\lambda$ and $\mu$ are the Lame coefficients. The following function
194  takes the displacement \var{u} and the Lame coefficients \var{lam} and \var{mu}  takes the displacement \var{u} and the Lame coefficients \var{lam} and \var{mu}
195  as arguments and returns the corresponding stress:  as arguments and returns the corresponding stress:
# Line 207  displacements are defined. Line 207  displacements are defined.
207  from 0 to \var{d}-1.  from 0 to \var{d}-1.
208  The call \var{grad(u)} requires the displacement field \var{u} to be in  The call \var{grad(u)} requires the displacement field \var{u} to be in
209  the \var{Solution} or \ContinuousFunction.  the \var{Solution} or \ContinuousFunction.
210  The result \var{g} as well as the returned stress will be in the \Function.  The result \var{g} as well as the returned stress will be in the \Function.
211  If, for example, \var{u} is the solution of a PDE then \code{getStress} might  If, for example, \var{u} is the solution of a PDE then \code{getStress} might
212  be called in the following way:  be called in the following way:
213  \begin{python}  \begin{python}
# Line 290  The tagged case has already been discuss Line 290  The tagged case has already been discuss
290  Expanded data is created when you create a \Data object with \code{expanded=True}.  Expanded data is created when you create a \Data object with \code{expanded=True}.
291  Tagged data sets are created when you use the \member{insertTaggedValue}  Tagged data sets are created when you use the \member{insertTaggedValue}
292  method as shown above.  method as shown above.
293    
294  Values are accessed through a sample reference number.  Values are accessed through a sample reference number.
295  Operations on expanded \Data objects have to be performed for each sample  Operations on expanded \Data objects have to be performed for each sample
296  point individually.  point individually.
# Line 399  in a restart directory and also stores \ Line 399  in a restart directory and also stores \
399  Additionally, it generates a \VTK file for visualization of the data.  Additionally, it generates a \VTK file for visualization of the data.
400    
401  \section{\escript Classes}  \section{\escript Classes}
 \declaremodule{extension}{esys.escript}  
 \modulesynopsis{Data manipulation}  
402    
403  \subsection{\Domain class}  \subsection{The \Domain class}
404  \begin{classdesc}{Domain}{}  \begin{classdesc}{Domain}{}
405  A \Domain object is used to describe a geometric region together with  A \Domain object is used to describe a geometric region together with
406  a way of representing functions over this region.  a way of representing functions over this region.
# Line 437  returns the local sample size, e.g. the Line 435  returns the local sample size, e.g. the
435  \end{methoddesc}  \end{methoddesc}
436    
437  \begin{methoddesc}[Domain]{setTagMap}{tag_name, tag}  \begin{methoddesc}[Domain]{setTagMap}{tag_name, tag}
438  defines a mapping of the tag name  \var{tag_name} to the \var{tag}.  defines a mapping of the tag name  \var{tag_name} to the \var{tag}.
439  \end{methoddesc}  \end{methoddesc}
440  \begin{methoddesc}[Domain]{getTag}{tag_name}  \begin{methoddesc}[Domain]{getTag}{tag_name}
441  returns the tag associated with the tag name \var{tag_name}.  returns the tag associated with the tag name \var{tag_name}.
# Line 452  return \True if \var{tag_name} is a vali Line 450  return \True if \var{tag_name} is a vali
450  \end{methoddesc}  \end{methoddesc}
451    
452  \begin{methoddesc}[Domain]{__ne__}{arg}  \begin{methoddesc}[Domain]{__ne__}{arg}
453  (python != operator) returns \True if the \Domain \var{arg} does not describe the same domain.  (python != operator) returns \True if the \Domain \var{arg} does not describe the same domain.
454  Otherwise \False is returned.  Otherwise \False is returned.
455  \end{methoddesc}  \end{methoddesc}
456    
# Line 461  Otherwise \False is returned. Line 459  Otherwise \False is returned.
459  \end{methoddesc}  \end{methoddesc}
460    
461  \begin{methoddesc}[Domain]{onMasterProcessor)}{}  \begin{methoddesc}[Domain]{onMasterProcessor)}{}
462  returns \True if the processor is the master processor within  returns \True if the processor is the master processor within
463  the \MPI processor group used by the \Domain. This is the processor with rank 0.  the \MPI processor group used by the \Domain. This is the processor with rank 0.
464  If \MPI support is not enabled the return value is always \True.  If \MPI support is not enabled the return value is always \True.
465  \end{methoddesc}  \end{methoddesc}
# Line 472  If \MPI support is not enabled the retur Line 470  If \MPI support is not enabled the retur
470  \end{methoddesc}  \end{methoddesc}
471    
472  \begin{methoddesc}[Domain]{getMPIRank}{}  \begin{methoddesc}[Domain]{getMPIRank}{}
473   returns the rank of the processor executing the statement   returns the rank of the processor executing the statement
474  within the  \MPI processor group used by the \Domain.  within the  \MPI processor group used by the \Domain.
475  If \MPI support is not enabled 0 is returned.  If \MPI support is not enabled 0 is returned.
476  \end{methoddesc}  \end{methoddesc}
477    
478  \begin{methoddesc}[Domain]{MPIBarrier}{}  \begin{methoddesc}[Domain]{MPIBarrier}{}
479  executes barrier synchronization within  executes barrier synchronization within
480  the \MPI processor group used by the \Domain.  the \MPI processor group used by the \Domain.
481  If \MPI support is not enabled, this command does nothing.  If \MPI support is not enabled, this command does nothing.
482  \end{methoddesc}  \end{methoddesc}
483    
484  \subsection{\FunctionSpace class}  \subsection{The \FunctionSpace class}
485  \begin{classdesc}{FunctionSpace}{}  \begin{classdesc}{FunctionSpace}{}
486  \FunctionSpace objects are used to define properties of \Data objects, such as continuity. \FunctionSpace objects  \FunctionSpace objects are used to define properties of \Data objects, such as continuity. \FunctionSpace objects
487  are instantiated by generator functions. A \Data object in a particular \FunctionSpace is  are instantiated by generator functions. A \Data object in a particular \FunctionSpace is
488  represented by its values at \DataSamplePoints which are defined by the type and the \Domain of the  represented by its values at \DataSamplePoints which are defined by the type and the \Domain of the
489  \FunctionSpace.  \FunctionSpace.
490  \end{classdesc}  \end{classdesc}
# Line 502  returns the location of the \DataSampleP Line 500  returns the location of the \DataSampleP
500  \end{methoddesc}  \end{methoddesc}
501    
502  \begin{methoddesc}[FunctionSpace]{getNormal}{}  \begin{methoddesc}[FunctionSpace]{getNormal}{}
503  If the domain of functions in the \FunctionSpace  If the domain of functions in the \FunctionSpace
504  is a hyper-manifold (e.g. the boundary of a domain)  is a hyper-manifold (e.g. the boundary of a domain)
505  the method returns the outer normal at each of the  the method returns the outer normal at each of the
506  \DataSamplePoints. Otherwise an exception is raised.  \DataSamplePoints. Otherwise an exception is raised.
507  \end{methoddesc}  \end{methoddesc}
508    
509  \begin{methoddesc}[FunctionSpace]{getSize}{}  \begin{methoddesc}[FunctionSpace]{getSize}{}
510  returns a \Data objects measuring the spacing of the \DataSamplePoints.    returns a \Data objects measuring the spacing of the \DataSamplePoints.
511  The size may be zero.  The size may be zero.
512  \end{methoddesc}  \end{methoddesc}
513    
# Line 518  returns the \Domain of the \FunctionSpac Line 516  returns the \Domain of the \FunctionSpac
516  \end{methoddesc}  \end{methoddesc}
517    
518  \begin{methoddesc}[FunctionSpace]{setTags}{new_tag, mask}  \begin{methoddesc}[FunctionSpace]{setTags}{new_tag, mask}
519  assigns a new tag \var{new_tag} to all data sample  assigns a new tag \var{new_tag} to all data sample
520  where \var{mask} is positive for a least one data point.  where \var{mask} is positive for a least one data point.
521  \var{mask} must be defined on the this \FunctionSpace.  \var{mask} must be defined on the this \FunctionSpace.
522  Use the \var{setTagMap} to assign a tag name to \var{new_tag}.  Use the \var{setTagMap} to assign a tag name to \var{new_tag}.
523  \end{methoddesc}  \end{methoddesc}
# Line 530  Use the \var{setTagMap} to assign a tag Line 528  Use the \var{setTagMap} to assign a tag
528  \end{methoddesc}  \end{methoddesc}
529    
530  \begin{methoddesc}[FunctionSpace]{__ne__}{arg}  \begin{methoddesc}[FunctionSpace]{__ne__}{arg}
531  (python != operator) returns \True if the \Domain \var{arg} do not describe the same domain.  (python != operator) returns \True if the \Domain \var{arg} do not describe the same domain.
532  Otherwise \False is returned.  Otherwise \False is returned.
533  \end{methoddesc}  \end{methoddesc}
534    
# Line 541  Otherwise \False is returned. Line 539  Otherwise \False is returned.
539  The following function provide generators for \FunctionSpace objects:  The following function provide generators for \FunctionSpace objects:
540  \begin{funcdesc}{Function}{domain}  \begin{funcdesc}{Function}{domain}
541  returns the \Function on the \Domain \var{domain}. \Data objects in this type of \Function  returns the \Function on the \Domain \var{domain}. \Data objects in this type of \Function
542  are defined over the whole geometric region defined by \var{domain}.  are defined over the whole geometric region defined by \var{domain}.
543  \end{funcdesc}  \end{funcdesc}
544    
545  \begin{funcdesc}{ContinuousFunction}{domain}  \begin{funcdesc}{ContinuousFunction}{domain}
# Line 552  a continuous function. Line 550  a continuous function.
550    
551  \begin{funcdesc}{FunctionOnBoundary}{domain}  \begin{funcdesc}{FunctionOnBoundary}{domain}
552  returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function  returns the \ContinuousFunction on the \Domain domain. \Data objects in this type of \Function
553  are defined on the boundary of the geometric region defined by \var{domain}.  are defined on the boundary of the geometric region defined by \var{domain}.
554  \end{funcdesc}  \end{funcdesc}
555    
556  \begin{funcdesc}{FunctionOnContactZero}{domain}  \begin{funcdesc}{FunctionOnContactZero}{domain}
# Line 562  The discontinuity is defined when \var{d Line 560  The discontinuity is defined when \var{d
560  \end{funcdesc}  \end{funcdesc}
561    
562  \begin{funcdesc}{FunctionOnContactOne}{domain}  \begin{funcdesc}{FunctionOnContactOne}{domain}
563  returns the \FunctionOnContactOne on the \Domain domain.  returns the \FunctionOnContactOne on the \Domain domain.
564  \Data objects in this type of \Function  \Data objects in this type of \Function
565  are defined on side 1 of a discontinuity  within the geometric region defined by \var{domain}.  are defined on side 1 of a discontinuity  within the geometric region defined by \var{domain}.
566  The discontinuity is defined when \var{domain} is instantiated.  The discontinuity is defined when \var{domain} is instantiated.
# Line 571  The discontinuity is defined when \var{d Line 569  The discontinuity is defined when \var{d
569  \begin{funcdesc}{Solution}{domain}  \begin{funcdesc}{Solution}{domain}
570  returns the \SolutionFS on the \Domain domain. \Data objects in this type of \Function  returns the \SolutionFS on the \Domain domain. \Data objects in this type of \Function
571  are defined on geometric region defined by \var{domain} and are solutions of  are defined on geometric region defined by \var{domain} and are solutions of
572  partial differential equations \index{partial differential equation}.  partial differential equations \index{partial differential equation}.
573  \end{funcdesc}  \end{funcdesc}
574    
575  \begin{funcdesc}{ReducedSolution}{domain}  \begin{funcdesc}{ReducedSolution}{domain}
576  returns the \ReducedSolutionFS on the \Domain domain. \Data objects in this type of \Function  returns the \ReducedSolutionFS on the \Domain domain. \Data objects in this type of \Function
577  are defined on geometric region defined by \var{domain} and are solutions of  are defined on geometric region defined by \var{domain} and are solutions of
578  partial differential equations \index{partial differential equation} with a reduced smoothness  partial differential equations \index{partial differential equation} with a reduced smoothness
579  for the solution approximation.  for the solution approximation.
580  \end{funcdesc}  \end{funcdesc}
581    
582  \subsection{\Data Class}  \subsection{The \Data Class}
583  \label{SEC ESCRIPT DATA}  \label{SEC ESCRIPT DATA}
584    
585  The following table shows arithmetic operations that can be performed point-wise on  The following table shows arithmetic operations that can be performed point-wise on
# Line 651  The following expressions for taking and Line 649  The following expressions for taking and
649          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})\\          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})\\
650      \end{tabular}      \end{tabular}
651  \end{table}  \end{table}
652  where \var{s} is the \Shape of \var{arg} and  where \var{s} is the \Shape of \var{arg} and
653  \[0 \le \var{l0} \le \var{u0} \le \var{s[0]},\]  \[0 \le \var{l0} \le \var{u0} \le \var{s[0]},\]
654  \[0 \le \var{l1} \le \var{u1} \le \var{s[1]},\]  \[0 \le \var{l1} \le \var{u1} \le \var{s[1]},\]
655  \[0 \le \var{l2} \le \var{u2} \le \var{s[2]},\]  \[0 \le \var{l2} \le \var{u2} \le \var{s[2]},\]
656  \[0 \le \var{l3} \le \var{u3} \le \var{s[3]}.\]  \[0 \le \var{l3} \le \var{u3} \le \var{s[3]}.\]
657  Any of the lower indexes \var{l0}, \var{l1}, \var{l2} and \var{l3} may not be present in which case  Any of the lower indexes \var{l0}, \var{l1}, \var{l2} and \var{l3} may not be present in which case
658  $0$ is assumed.  $0$ is assumed.
659  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.  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.
660  The lower and upper index may be identical, in which case the column and the lower or upper  The lower and upper index may be identical, in which case the column and the lower or upper
661  index may be dropped. In the returned or in the object assigned to a slice, the corresponding component is dropped,  index may be dropped. In the returned or in the object assigned to a slice, the corresponding component is dropped,
662  i.e. the rank is reduced by one in comparison to \var{arg}.  i.e. the rank is reduced by one in comparison to \var{arg}.
# Line 679  the \Data object is represented in expan Line 677  the \Data object is represented in expan
677  \end{classdesc}  \end{classdesc}
678    
679  \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False}  \begin{classdesc}{Data}{value,what=FunctionSpace(),expand=\False}
680  creates a \Data object in the \FunctionSpace \var{what}.  creates a \Data object in the \FunctionSpace \var{what}.
681  The value for each \DataSamplePoints is set to \var{value}, which could be a \numpy, \Data object \var{value} or a dictionary of  The value for each \DataSamplePoints is set to \var{value}, which could be a \numpy, \Data object \var{value} or a dictionary of
682  \numpy or floating point numbers. In the latter case the keys must be integers and are used  \numpy or floating point numbers. In the latter case the keys must be integers and are used
683  as tags.  as tags.
684  The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True  The \Shape of the returned object is equal to the \Shape of \var{value}. If \var{expanded} is \True
# Line 731  recovers a \Data object on \Domain \var{ Line 729  recovers a \Data object on \Domain \var{
729  \end{funcdesc}  \end{funcdesc}
730    
731  \subsection{\Data methods}  \subsection{\Data methods}
732  These are the most frequently-used methods of the  These are the most frequently-used methods of the
733  \Data class. A complete list of methods can be found on \ReferenceGuide.  \Data class. A complete list of methods can be found on \ReferenceGuide.
734  \begin{methoddesc}[Data]{getFunctionSpace}{}  \begin{methoddesc}[Data]{getFunctionSpace}{}
735  returns the \FunctionSpace of the object.  returns the \FunctionSpace of the object.
# Line 772  the value assigned to \DataSamplePoints Line 770  the value assigned to \DataSamplePoints
770  \begin{methoddesc}[Data]{dump}{filename}  \begin{methoddesc}[Data]{dump}{filename}
771  dumps the \Data object to the file \var{filename}. The file stores the  dumps the \Data object to the file \var{filename}. The file stores the
772  function space but not the \Domain. It is in the responsibility of the user to  function space but not the \Domain. It is in the responsibility of the user to
773  save the \Domain.  save the \Domain.
774  \end{methoddesc}  \end{methoddesc}
775    
776  \begin{methoddesc}[Data]{__str__}{}  \begin{methoddesc}[Data]{__str__}{}
# Line 783  returns a string representation of the o Line 781  returns a string representation of the o
781  This section lists the most important functions for \Data class objects \var{a}.  This section lists the most important functions for \Data class objects \var{a}.
782  A complete list and a more detailed description of the functionality can be found on \ReferenceGuide.  A complete list and a more detailed description of the functionality can be found on \ReferenceGuide.
783  \begin{funcdesc}{saveVTK}{filename,**kwdata}  \begin{funcdesc}{saveVTK}{filename,**kwdata}
784  writes \Data defined by keywords in the file with \var{filename} using the  writes \Data defined by keywords in the file with \var{filename} using the
785  vtk file format \VTK file format. The key word is used as an identifier. The statement  vtk file format \VTK file format. The key word is used as an identifier. The statement
786  \begin{python}  \begin{python}
787    saveVTK("out.xml",temperature=T,velocity=v)    saveVTK("out.xml",temperature=T,velocity=v)
788  \end{python}  \end{python}
789  will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the  will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the
790  file \file{out.xml}. Restrictions on the allowed combinations of \FunctionSpace apply.  file \file{out.xml}. Restrictions on the allowed combinations of \FunctionSpace apply.
791  \end{funcdesc}  \end{funcdesc}
792  \begin{funcdesc}{saveDX}{filename,**kwdata}  \begin{funcdesc}{saveDX}{filename,**kwdata}
793  writes \Data defined by keywords in the file with \var{filename} using the  writes \Data defined by keywords in the file with \var{filename} using the
794  vtk file format \OpenDX file format. The key word is used as an identifier. The statement  vtk file format \OpenDX file format. The key word is used as an identifier. The statement
795  \begin{python}  \begin{python}
796    saveDX("out.dx",temperature=T,velocity=v)    saveDX("out.dx",temperature=T,velocity=v)
797  \end{python}  \end{python}
798  will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the  will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the
799  file \file{out.dx}. Restrictions on the allowed combinations of \FunctionSpace apply.  file \file{out.dx}. Restrictions on the allowed combinations of \FunctionSpace apply.
800  \end{funcdesc}  \end{funcdesc}
801  \begin{funcdesc}{kronecker}{d}  \begin{funcdesc}{kronecker}{d}
802  returns a \RankTwo \Data object in \FunctionSpace \var{d} such that  returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
803  \begin{equation}  \begin{equation}
804  \code{kronecker(d)}\left[ i,j\right] = \left\{  \code{kronecker(d)}\left[ i,j\right] = \left\{
805  \begin{array}{cc}  \begin{array}{cc}
806  1 & \mbox{ if } i=j \\  1 & \mbox{ if } i=j \\
807  0 & \mbox{ otherwise }  0 & \mbox{ otherwise }
# Line 816  If \var{d} is an integer a $(d,d)$ \nump Line 814  If \var{d} is an integer a $(d,d)$ \nump
814  is a synonym for \code{kronecker} (see above).  is a synonym for \code{kronecker} (see above).
815  % returns a \RankTwo \Data object in \FunctionSpace \var{d} such that  % returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
816  % \begin{equation}  % \begin{equation}
817  % \code{identityTensor(d)}\left[ i,j\right] = \left\{  % \code{identityTensor(d)}\left[ i,j\right] = \left\{
818  % \begin{array}{cc}  % \begin{array}{cc}
819  % 1 & \mbox{ if } i=j \\  % 1 & \mbox{ if } i=j \\
820  % 0 & \mbox{ otherwise }  % 0 & \mbox{ otherwise }
# Line 828  is a synonym for \code{kronecker} (see a Line 826  is a synonym for \code{kronecker} (see a
826  \begin{funcdesc}{identityTensor4}{d}  \begin{funcdesc}{identityTensor4}{d}
827  returns a \RankFour \Data object in \FunctionSpace \var{d} such that  returns a \RankFour \Data object in \FunctionSpace \var{d} such that
828  \begin{equation}  \begin{equation}
829  \code{identityTensor(d)}\left[ i,j,k,l\right] = \left\{  \code{identityTensor(d)}\left[ i,j,k,l\right] = \left\{
830  \begin{array}{cc}  \begin{array}{cc}
831  1 & \mbox{ if } i=k \mbox{ and } j=l\\  1 & \mbox{ if } i=k \mbox{ and } j=l\\
832  0 & \mbox{ otherwise }  0 & \mbox{ otherwise }
# Line 840  If \var{d} is an integer a $(d,d,d,d)$ \ Line 838  If \var{d} is an integer a $(d,d,d,d)$ \
838  \begin{funcdesc}{unitVector}{i,d}  \begin{funcdesc}{unitVector}{i,d}
839  returns a \RankOne \Data object in \FunctionSpace \var{d} such that  returns a \RankOne \Data object in \FunctionSpace \var{d} such that
840  \begin{equation}  \begin{equation}
841  \code{identityTensor(d)}\left[ j \right] = \left\{  \code{identityTensor(d)}\left[ j \right] = \left\{
842  \begin{array}{cc}  \begin{array}{cc}
843  1 & \mbox{ if } j=i\\  1 & \mbox{ if } j=i\\
844  0 & \mbox{ otherwise }  0 & \mbox{ otherwise }
# Line 853  If \var{d} is an integer a $(d,)$ \numpy Line 851  If \var{d} is an integer a $(d,)$ \numpy
851    
852  \begin{funcdesc}{Lsup}{a}  \begin{funcdesc}{Lsup}{a}
853  returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values  returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values
854   over all components and all \DataSamplePoints of \var{a}.   over all components and all \DataSamplePoints of \var{a}.
855  \end{funcdesc}  \end{funcdesc}
856    
857  \begin{funcdesc}{sup}{a}  \begin{funcdesc}{sup}{a}
# Line 877  returns at each \DataSamplePoints the ma Line 875  returns at each \DataSamplePoints the ma
875  \begin{funcdesc}{length}{a}  \begin{funcdesc}{length}{a}
876  returns at Euclidean norm at each \DataSamplePoints. For a \RankFour \var{a} this is  returns at Euclidean norm at each \DataSamplePoints. For a \RankFour \var{a} this is
877  \begin{equation}  \begin{equation}
878  \code{length(a)}=\sqrt{\sum\hackscore{ijkl} \var{a} \left[i,j,k,l\right]^2}  \code{length(a)}=\sqrt{\sum_{ijkl} \var{a} \left[i,j,k,l\right]^2}
879  \end{equation}  \end{equation}
880  \end{funcdesc}  \end{funcdesc}
881  \begin{funcdesc}{trace}{a\optional{,axis_offset=0}}  \begin{funcdesc}{trace}{a\optional{,axis_offset=0}}
882  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  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
883  case of a \RankTwo function and this is  case of a \RankTwo function and this is
884  \begin{equation}  \begin{equation}
885  \code{trace(a)}=\sum\hackscore{i} \var{a} \left[i,i\right]  \code{trace(a)}=\sum_{i} \var{a} \left[i,i\right]
886  \end{equation}  \end{equation}
887  and for a \RankFour function and  \code{axis_offset=1} this is  and for a \RankFour function and  \code{axis_offset=1} this is
888  \begin{equation}  \begin{equation}
889  \code{trace(a,1)}\left[i,j\right]=\sum\hackscore{k} \var{a} \left[i,k,k,j\right]  \code{trace(a,1)}\left[i,j\right]=\sum_{k} \var{a} \left[i,k,k,j\right]
890  \end{equation}  \end{equation}
891  \end{funcdesc}  \end{funcdesc}
892    
893  \begin{funcdesc}{transpose}{a\optional{, axis_offset=None}}  \begin{funcdesc}{transpose}{a\optional{, axis_offset=None}}
894  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  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
895  present \code{int(r/2)} is used where \var{r} is the rank of \var{a}.  present \code{int(r/2)} is used where \var{r} is the rank of \var{a}.
896   the sum over components \var{axis_offset} and \var{axis_offset+1} with the same index. For instance in the   the sum over components \var{axis_offset} and \var{axis_offset+1} with the same index. For instance in the
897  case of a \RankTwo function and this is  case of a \RankTwo function and this is
898  \begin{equation}  \begin{equation}
899  \code{transpose(a)}\left[i,j\right]=\var{a} \left[j,i\right]  \code{transpose(a)}\left[i,j\right]=\var{a} \left[j,i\right]
900  \end{equation}  \end{equation}
901  and for a \RankFour function and  \code{axis_offset=1} this is  and for a \RankFour function and  \code{axis_offset=1} this is
902  \begin{equation}  \begin{equation}
903  \code{transpose(a,1)}\left[i,j,k,l\right]=\var{a} \left[j,k,l,i\right]  \code{transpose(a,1)}\left[i,j,k,l\right]=\var{a} \left[j,k,l,i\right]
904  \end{equation}  \end{equation}
905  \end{funcdesc}  \end{funcdesc}
906    
907  \begin{funcdesc}{swap_axes}{a\optional{, axis0=0 \optional{, axis1=1 }}}  \begin{funcdesc}{swap_axes}{a\optional{, axis0=0 \optional{, axis1=1 }}}
908  returns \var{a} but with swapped components \var{axis0} and  \var{axis1}. The argument \var{a} must be  returns \var{a} but with swapped components \var{axis0} and  \var{axis1}. The argument \var{a} must be
909  at least of \RankTwo. For instance in the  at least of \RankTwo. For instance in the
910  for a \RankFour argument, \code{axis0=1} and \code{axis1=2} this is  for a \RankFour argument, \code{axis0=1} and \code{axis1=2} this is
911  \begin{equation}  \begin{equation}
912  \code{swap_axes(a,1,2)}\left[i,j,k,l\right]=\var{a} \left[i,k,j,l\right]  \code{swap_axes(a,1,2)}\left[i,j,k,l\right]=\var{a} \left[i,k,j,l\right]
913  \end{equation}  \end{equation}
914  \end{funcdesc}  \end{funcdesc}
915    
916  \begin{funcdesc}{symmetric}{a}  \begin{funcdesc}{symmetric}{a}
# Line 922  returns the symmetric part of \var{a}. T Line 920  returns the symmetric part of \var{a}. T
920  returns the non--symmetric part of \var{a}. This is \code{(a-transpose(a))/2}.  returns the non--symmetric part of \var{a}. This is \code{(a-transpose(a))/2}.
921  \end{funcdesc}  \end{funcdesc}
922  \begin{funcdesc}{inverse}{a}  \begin{funcdesc}{inverse}{a}
923  return the inverse of \var{a}. This is  return the inverse of \var{a}. This is
924  \begin{equation}  \begin{equation}
925  \code{matrix_mult(inverse(a),a)=kronecker(d)}  \code{matrix_mult(inverse(a),a)=kronecker(d)}
926  \end{equation}  \end{equation}
927  if \var{a} has shape \code{(d,d)}. The current implementation is restricted to arguments of shape  if \var{a} has shape \code{(d,d)}. The current implementation is restricted to arguments of shape
928  \code{(2,2)} and \code{(3,3)}.  \code{(2,2)} and \code{(3,3)}.
929  \end{funcdesc}  \end{funcdesc}
930  \begin{funcdesc}{eigenvalues}{a}  \begin{funcdesc}{eigenvalues}{a}
931  return the eigenvalues of \var{a}. This is  return the eigenvalues of \var{a}. This is
932  \begin{equation}  \begin{equation}
933  \code{matrix_mult(a,V)=e[i]*V}  \code{matrix_mult(a,V)=e[i]*V}
934  \end{equation}  \end{equation}
935  where \code{e=eigenvalues(a)} and \var{V} is suitable non--zero vector \var{V}.  where \code{e=eigenvalues(a)} and \var{V} is suitable non--zero vector \var{V}.
936  The eigenvalues are ordered in increasing size.  The eigenvalues are ordered in increasing size.
937  The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.    The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.
938  The current implementation is restricted to arguments of shape  The current implementation is restricted to arguments of shape
939  \code{(2,2)} and \code{(3,3)}.  \code{(2,2)} and \code{(3,3)}.
940  \end{funcdesc}  \end{funcdesc}
941  \begin{funcdesc}{eigenvalues_and_eigenvectors}{a}  \begin{funcdesc}{eigenvalues_and_eigenvectors}{a}
942  return the eigenvalues and eigenvectors of \var{a}. This is  return the eigenvalues and eigenvectors of \var{a}. This is
943  \begin{equation}  \begin{equation}
944  \code{matrix_mult(a,V[:,i])=e[i]*V[:,i]}  \code{matrix_mult(a,V[:,i])=e[i]*V[:,i]}
945  \end{equation}  \end{equation}
946  where \code{e,V=eigenvalues_and_eigenvectors(a)}. The eigenvectors \var{V} are orthogonal and normalized, ie.  where \code{e,V=eigenvalues_and_eigenvectors(a)}. The eigenvectors \var{V} are orthogonal and normalized, ie.
947  \begin{equation}  \begin{equation}
948  \code{matrix_mult(transpose(V),V)=kronecker(d)}  \code{matrix_mult(transpose(V),V)=kronecker(d)}
949  \end{equation}  \end{equation}
950  if \var{a} has shape \code{(d,d)}. The eigenvalues are ordered in increasing size.  if \var{a} has shape \code{(d,d)}. The eigenvalues are ordered in increasing size.
951  The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.    The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.
952  The current implementation is restricted to arguments of shape  The current implementation is restricted to arguments of shape
953  \code{(2,2)} and \code{(3,3)}.  \code{(2,2)} and \code{(3,3)}.
954  \end{funcdesc}  \end{funcdesc}
955  \begin{funcdesc}{maximum}{*a}  \begin{funcdesc}{maximum}{*a}
956  returns the maximum value over all arguments at all \DataSamplePoints and for each component.  returns the maximum value over all arguments at all \DataSamplePoints and for each component.
957  For instance  For instance
958  \begin{equation}  \begin{equation}
959  \code{maximum(a0,a1)}\left[i,j\right]=max(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])  \code{maximum(a0,a1)}\left[i,j\right]=max(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
960  \end{equation}  \end{equation}
# Line 964  at all \DataSamplePoints. Line 962  at all \DataSamplePoints.
962  \end{funcdesc}  \end{funcdesc}
963  \begin{funcdesc}{minimum}{*a}  \begin{funcdesc}{minimum}{*a}
964  returns the minimum value over all arguments at all \DataSamplePoints and for each component.  returns the minimum value over all arguments at all \DataSamplePoints and for each component.
965  For instance  For instance
966  \begin{equation}  \begin{equation}
967  \code{minimum(a0,a1)}\left[i,j\right]=min(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])  \code{minimum(a0,a1)}\left[i,j\right]=min(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
968  \end{equation}  \end{equation}
# Line 972  at all \DataSamplePoints. Line 970  at all \DataSamplePoints.
970  \end{funcdesc}  \end{funcdesc}
971    
972  \begin{funcdesc}{clip}{a\optional{, minval=0.}\optional{, maxval=1.}}  \begin{funcdesc}{clip}{a\optional{, minval=0.}\optional{, maxval=1.}}
973  cuts back \var{a} into the range between \var{minval} and \var{maxval}. A value in the returned object equals  cuts back \var{a} into the range between \var{minval} and \var{maxval}. A value in the returned object equals
974  \var{minval} if the corresponding value of \var{a} is less than \var{minval}, equals \var{maxval} if the  \var{minval} if the corresponding value of \var{a} is less than \var{minval}, equals \var{maxval} if the
975   corresponding value of \var{a} is greater than \var{maxval}   corresponding value of \var{a} is greater than \var{maxval}
976  or corresponding value of \var{a} otherwise.  or corresponding value of \var{a} otherwise.
977  \end{funcdesc}  \end{funcdesc}
978  \begin{funcdesc}{inner}{a0,a1}  \begin{funcdesc}{inner}{a0,a1}
979  returns the inner product of \var{a0} and \var{a1}. For instance in the  returns the inner product of \var{a0} and \var{a1}. For instance in the
980  case of \RankTwo arguments and this is  case of \RankTwo arguments and this is
981  \begin{equation}  \begin{equation}
982  \code{inner(a)}=\sum\hackscore{ij}\var{a0} \left[j,i\right]  \cdot \var{a1} \left[j,i\right]  \code{inner(a)}=\sum_{ij}\var{a0} \left[j,i\right]  \cdot \var{a1} \left[j,i\right]
983  \end{equation}  \end{equation}
984  and for a \RankFour arguments this is  and for a \RankFour arguments this is
985  \begin{equation}  \begin{equation}
986  \code{inner(a)}=\sum\hackscore{ijkl}\var{a0} \left[i,j,k,l\right]  \cdot \var{a1} \left[j,i,k,l\right]  \code{inner(a)}=\sum_{ijkl}\var{a0} \left[i,j,k,l\right]  \cdot \var{a1} \left[j,i,k,l\right]
987  \end{equation}  \end{equation}
988  \end{funcdesc}  \end{funcdesc}
989    
990  \begin{funcdesc}{matrix_mult}{a0,a1}  \begin{funcdesc}{matrix_mult}{a0,a1}
991  returns the matrix product of \var{a0} and \var{a1}. If \var{a1} is \RankOne this is  returns the matrix product of \var{a0} and \var{a1}. If \var{a1} is \RankOne this is
992  \begin{equation}  \begin{equation}
993  \code{matrix_mult(a)}\left[i\right]=\sum\hackscore{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k\right]  \code{matrix_mult(a)}\left[i\right]=\sum_{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k\right]
994  \end{equation}  \end{equation}
995  and if \var{a1} is \RankTwo this is  and if \var{a1} is \RankTwo this is
996  \begin{equation}  \begin{equation}
997  \code{matrix_mult(a)}\left[i,j\right]=\sum\hackscore{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k,j\right]  \code{matrix_mult(a)}\left[i,j\right]=\sum_{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k,j\right]
998  \end{equation}  \end{equation}
999  \end{funcdesc}  \end{funcdesc}
1000    
1001  \begin{funcdesc}{transposed_matrix_mult}{a0,a1}  \begin{funcdesc}{transposed_matrix_mult}{a0,a1}
1002  returns the matrix product of the transposed of \var{a0} and \var{a1}. The function is equivalent to  returns the matrix product of the transposed of \var{a0} and \var{a1}. The function is equivalent to
1003  \code{matrix_mult(transpose(a0),a1)}.  \code{matrix_mult(transpose(a0),a1)}.
1004  If \var{a1} is \RankOne this is  If \var{a1} is \RankOne this is
1005  \begin{equation}  \begin{equation}
1006  \code{transposed_matrix_mult(a)}\left[i\right]=\sum\hackscore{k}\var{a0}  \cdot \left[k,i\right]\var{a1} \left[k\right]  \code{transposed_matrix_mult(a)}\left[i\right]=\sum_{k}\var{a0}  \cdot \left[k,i\right]\var{a1} \left[k\right]
1007  \end{equation}  \end{equation}
1008  and if \var{a1} is \RankTwo this is  and if \var{a1} is \RankTwo this is
1009  \begin{equation}  \begin{equation}
1010  \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]  \code{transposed_matrix_mult(a)}\left[i,j\right]=\sum_{k}\var{a0}  \cdot \left[k,i\right]\var{a1} \left[k,j\right]
1011  \end{equation}  \end{equation}
1012  \end{funcdesc}  \end{funcdesc}
1013    
1014  \begin{funcdesc}{matrix_transposed_mult}{a0,a1}  \begin{funcdesc}{matrix_transposed_mult}{a0,a1}
1015  returns the matrix product of \var{a0} and the transposed of \var{a1}.  returns the matrix product of \var{a0} and the transposed of \var{a1}.
1016  The function is equivalent to  The function is equivalent to
1017  \code{matrix_mult(a0,transpose(a1))}.    \code{matrix_mult(a0,transpose(a1))}.
1018  If \var{a1} is \RankTwo this is  If \var{a1} is \RankTwo this is
1019  \begin{equation}  \begin{equation}
1020  \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]  \code{matrix_transposed_mult(a)}\left[i,j\right]=\sum_{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[j,k\right]
1021  \end{equation}  \end{equation}
1022  \end{funcdesc}  \end{funcdesc}
1023    
1024  \begin{funcdesc}{outer}{a0,a1}  \begin{funcdesc}{outer}{a0,a1}
1025  returns the outer product of \var{a0} and \var{a1}. For instance if \var{a0} and \var{a1} both are \RankOne then  returns the outer product of \var{a0} and \var{a1}. For instance if \var{a0} and \var{a1} both are \RankOne then
1026  \begin{equation}  \begin{equation}
1027  \code{outer(a)}\left[i,j\right]=\var{a0} \left[i\right]  \cdot  \var{a1}\left[j\right]  \code{outer(a)}\left[i,j\right]=\var{a0} \left[i\right]  \cdot  \var{a1}\left[j\right]
1028  \end{equation}  \end{equation}
1029  and if \var{a0} is \RankOne and \var{a1} is \RankThree  and if \var{a0} is \RankOne and \var{a1} is \RankThree
1030  \begin{equation}  \begin{equation}
1031  \code{outer(a)}\left[i,j,k\right]=\var{a0} \left[i\right] \cdot \var{a1}\left[j,k\right]  \code{outer(a)}\left[i,j,k\right]=\var{a0} \left[i\right] \cdot \var{a1}\left[j,k\right]
1032  \end{equation}  \end{equation}
1033  \end{funcdesc}  \end{funcdesc}
1034    
1035  \begin{funcdesc}{tensor_mult}{a0,a1}  \begin{funcdesc}{tensor_mult}{a0,a1}
1036  returns the tensor product of \var{a0} and \var{a1}. If \var{a1} is \RankTwo this is  returns the tensor product of \var{a0} and \var{a1}. If \var{a1} is \RankTwo this is
1037  \begin{equation}  \begin{equation}
1038  \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]  \code{tensor_mult(a)}\left[i,j\right]=\sum_{kl}\var{a0}\left[i,j,k,l\right] \cdot \var{a1} \left[k,l\right]
1039  \end{equation}  \end{equation}
1040  and if \var{a1} is \RankFour this is  and if \var{a1} is \RankFour this is
1041  \begin{equation}  \begin{equation}
1042  \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]  \code{tensor_mult(a)}\left[i,j,k,l\right]=\sum_{mn}\var{a0} \left[i,j,m,n\right] \cdot \var{a1} \left[m,n,k,l\right]
1043  \end{equation}  \end{equation}
1044  \end{funcdesc}  \end{funcdesc}
1045    
1046  \begin{funcdesc}{transposed_tensor_mult}{a0,a1}  \begin{funcdesc}{transposed_tensor_mult}{a0,a1}
# Line 1050  returns the tensor product of the transp Line 1048  returns the tensor product of the transp
1048  \code{tensor_mult(transpose(a0),a1)}.  \code{tensor_mult(transpose(a0),a1)}.
1049  If \var{a1} is \RankTwo this is  If \var{a1} is \RankTwo this is
1050  \begin{equation}  \begin{equation}
1051  \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]  \code{transposed_tensor_mult(a)}\left[i,j\right]=\sum_{kl}\var{a0}\left[k,l,i,j\right] \cdot \var{a1} \left[k,l\right]
1052  \end{equation}  \end{equation}
1053  and if \var{a1} is \RankFour this is  and if \var{a1} is \RankFour this is
1054  \begin{equation}  \begin{equation}
1055  \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]  \code{transposed_tensor_mult(a)}\left[i,j,k,l\right]=\sum_{mn}\var{a0} \left[m,n,i,j\right] \cdot \var{a1} \left[m,n,k,l\right]
1056  \end{equation}  \end{equation}
1057  \end{funcdesc}  \end{funcdesc}
1058    
1059  \begin{funcdesc}{tensor_transposed_mult}{a0,a1}  \begin{funcdesc}{tensor_transposed_mult}{a0,a1}
1060  returns the tensor product of \var{a0} and the transposed of \var{a1}.  returns the tensor product of \var{a0} and the transposed of \var{a1}.
1061  The function is equivalent to  The function is equivalent to
1062  \code{tensor_mult(a0,transpose(a1))}.  \code{tensor_mult(a0,transpose(a1))}.
1063  If \var{a1} is \RankTwo this is  If \var{a1} is \RankTwo this is
1064  \begin{equation}  \begin{equation}
1065  \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]  \code{tensor_transposed_mult(a)}\left[i,j\right]=\sum_{kl}\var{a0}\left[i,j,k,l\right] \cdot \var{a1} \left[l,k\right]
1066  \end{equation}  \end{equation}
1067  and if \var{a1} is \RankFour this is  and if \var{a1} is \RankFour this is
1068  \begin{equation}  \begin{equation}
1069  \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]  \code{tensor_transposed_mult(a)}\left[i,j,k,l\right]=\sum_{mn}\var{a0} \left[i,j,m,n\right] \cdot \var{a1} \left[k,l,m,n\right]
1070  \end{equation}  \end{equation}
1071  \end{funcdesc}  \end{funcdesc}
1072    
1073  \begin{funcdesc}{grad}{a\optional{, where=None}}  \begin{funcdesc}{grad}{a\optional{, where=None}}
1074  returns the gradient of \var{a}. If \var{where} is present the gradient will be calculated in \FunctionSpace \var{where} otherwise a  returns the gradient of \var{a}. If \var{where} is present the gradient will be calculated in \FunctionSpace \var{where} otherwise a
1075  default \FunctionSpace is used. In case that \var{a} has \RankTwo one has  default \FunctionSpace is used. In case that \var{a} has \RankTwo one has
1076  \begin{equation}  \begin{equation}
1077  \code{grad(a)}\left[i,j,k\right]=\frac{\partial \var{a} \left[i,j\right]}{\partial x\hackscore{k}}  \code{grad(a)}\left[i,j,k\right]=\frac{\partial \var{a} \left[i,j\right]}{\partial x_{k}}
1078  \end{equation}  \end{equation}
1079  \end{funcdesc}  \end{funcdesc}
1080  \begin{funcdesc}{integrate}{a\optional{ ,where=None}}  \begin{funcdesc}{integrate}{a\optional{ ,where=None}}
1081  returns the integral of \var{a} where the domain of integration is defined by the \FunctionSpace of \var{a}. If \var{where} is  returns the integral of \var{a} where the domain of integration is defined by the \FunctionSpace of \var{a}. If \var{where} is
1082  present the argument is interpolated into \FunctionSpace \var{where} before integration. For instance in the case of  present the argument is interpolated into \FunctionSpace \var{where} before integration. For instance in the case of
1083  a \RankTwo argument in \ContinuousFunction it is  a \RankTwo argument in \ContinuousFunction it is
1084  \begin{equation}  \begin{equation}
1085  \code{integrate(a)}\left[i,j\right]=\int\hackscore{\Omega}\var{a} \left[i,j\right] \; d\Omega  \code{integrate(a)}\left[i,j\right]=\int_{\Omega}\var{a} \left[i,j\right] \; d\Omega
1086  \end{equation}  \end{equation}
1087  where $\Omega$ is the spatial domain and $d\Omega$ volume integration. To integrate over the boundary of the domain one uses    where $\Omega$ is the spatial domain and $d\Omega$ volume integration. To integrate over the boundary of the domain one uses
1088  \begin{equation}  \begin{equation}
1089  \code{integrate(a,where=FunctionOnBoundary(a.getDomain))}\left[i,j\right]=\int\hackscore{\partial \Omega} a\left[i,j\right] \; ds  \code{integrate(a,where=FunctionOnBoundary(a.getDomain))}\left[i,j\right]=\int_{\partial \Omega} a\left[i,j\right] \; ds
1090  \end{equation}  \end{equation}
1091  where $\partial \Omega$ is the surface of the spatial domain and $ds$ area or line integration.  where $\partial \Omega$ is the surface of the spatial domain and $ds$ area or line integration.
1092  \end{funcdesc}  \end{funcdesc}
1093  \begin{funcdesc}{interpolate}{a,where}  \begin{funcdesc}{interpolate}{a,where}
1094  interpolates argument \var{a} into the \FunctionSpace \var{where}.  interpolates argument \var{a} into the \FunctionSpace \var{where}.
1095  \end{funcdesc}  \end{funcdesc}
1096  \begin{funcdesc}{div}{a\optional{ ,where=None}}  \begin{funcdesc}{div}{a\optional{ ,where=None}}
1097  returns the divergence of \var{a}. This  returns the divergence of \var{a}. This
1098  \begin{equation}  \begin{equation}
1099  \code{div(a)}=trace(grad(a),where)  \code{div(a)}=trace(grad(a),where)
1100  \end{equation}  \end{equation}
# Line 1112  in \var{domain}. Line 1110  in \var{domain}.
1110  \end{equation}  \end{equation}
1111  \end{funcdesc}  \end{funcdesc}
1112  \begin{funcdesc}{L2}{a}  \begin{funcdesc}{L2}{a}
1113  returns the $L^2$-norm of \var{a} in its function space. This is  returns the $L^2$-norm of \var{a} in its function space. This is
1114  \begin{equation}  \begin{equation}
1115  \code{L2(a)=integrate(length(a)}^2\code{)} \; .  \code{L2(a)=integrate(length(a)}^2\code{)} \; .
1116  \end{equation}  \end{equation}
1117  \end{funcdesc}  \end{funcdesc}
1118    
1119  The following functions operate ``point-wise''. That is, the operation is applied to each component of each point  The following functions operate ``point-wise''. That is, the operation is applied to each component of each point
# Line 1217  returns a function which is $1$ where \v Line 1215  returns a function which is $1$ where \v
1215  \subsection{Interpolating Data}  \subsection{Interpolating Data}
1216  \index{interpolateTable}  \index{interpolateTable}
1217  In some cases, it may be useful to produce Data objects which fit some user defined function.  In some cases, it may be useful to produce Data objects which fit some user defined function.
1218  Manually modifying each value in the Data object is not a good idea since it depends on  Manually modifying each value in the Data object is not a good idea since it depends on
1219  knowing the location and order of each datapoint in the domain.  knowing the location and order of each datapoint in the domain.
1220  Instead \escript can use an interpolation table to produce a Data object.  Instead \escript can use an interpolation table to produce a Data object.
1221    
# Line 1239  toobig=100 Line 1237  toobig=100
1237    
1238  First we produce an interpolation table.  First we produce an interpolation table.
1239  \begin{python}  \begin{python}
1240  sine_table=[0, 0.70710678118654746, 1, 0.70710678118654746, 0,  sine_table=[0, 0.70710678118654746, 1, 0.70710678118654746, 0,
1241             -0.70710678118654746, -1, -0.70710678118654746, 0]             -0.70710678118654746, -1, -0.70710678118654746, 0]
1242  \end{python}  \end{python}
1243    
1244  We wish to identify $0$ and $1$ with the ends of the curve.  We wish to identify $0$ and $1$ with the ends of the curve.
1245  That is, with the first and eighth values in the table.  That is, with the first and eighth values in the table.
1246    
1247  \begin{python}  \begin{python}
1248  numslices=len(sine_table)-1  numslices=len(sine_table)-1
# Line 1266  Now we produce our new \Data object. Line 1264  Now we produce our new \Data object.
1264  \begin{python}  \begin{python}
1265  result=x0.interpolateTable(sine_table, minval, step, toobig)  result=x0.interpolateTable(sine_table, minval, step, toobig)
1266  \end{python}  \end{python}
1267  Any values which interpolate to larger than \var{toobig} will raise an exception. You can  Any values which interpolate to larger than \var{toobig} will raise an exception. You can
1268  switch on boundary checking by adding ''check_boundaries=True`` the argument list.  switch on boundary checking by adding ''check_boundaries=True`` the argument list.
1269    
1270    
# Line 1287  The use of numpy and multiplication here Line 1285  The use of numpy and multiplication here
1285  result2=x1.interpolateTable(table, 0, 0.55, x0, minval, step, toobig)  result2=x1.interpolateTable(table, 0, 0.55, x0, minval, step, toobig)
1286  \end{python}  \end{python}
1287    
1288  In the 2D case, the parameters for the x1 direction (min=0, step=0.55) come first followed by the x0 data object and  In the 2D case, the parameters for the x1 direction (min=0, step=0.55) come first followed by the x0 data object and
1289  its parameters.  its parameters.
1290  By default, if a point is specified which is outside the boundary, then \var{interpolateTable} will operate  By default, if a point is specified which is outside the boundary, then \var{interpolateTable} will operate
1291  as if the point was on the boundary.  as if the point was on the boundary.
# Line 1328  saveDataCSV('data.csv', append=True, sep Line 1326  saveDataCSV('data.csv', append=True, sep
1326  \begin{itemize}  \begin{itemize}
1327   \item \var{append} - specifies that the output should be written to the end of an existing file.   \item \var{append} - specifies that the output should be written to the end of an existing file.
1328  \item \var{sep} - defines the separator between fields.  \item \var{sep} - defines the separator between fields.
1329  \item \var{csep} - defines the separator between components in the header line. For example between the components of a matrix.  \item \var{csep} - defines the separator between components in the header line. For example between the components of a matrix.
1330  \end{itemize}  \end{itemize}
1331    
1332  The above command would produce output like this:  The above command would produce output like this:
1333  \begin{verbatim}  \begin{verbatim}
1334  e/0/0 e/1/0 e/0/1 e/1/1  e/0/0 e/1/0 e/0/1 e/1/1
1335  1.0000000000e+00 2.0000000000e+00 3.0000000000e+00 4.0000000000e+00  1.0000000000e+00 2.0000000000e+00 3.0000000000e+00 4.0000000000e+00
1336  ...  ...
1337  \end{verbatim}  \end{verbatim}
1338    
1339  Note that while the order in which rows are output can vary, all the elements in a given row  Note that while the order in which rows are output can vary, all the elements in a given row
1340  always correspond to the same input.  always correspond to the same input.
1341    
1342    
1343  \subsection{\Operator Class}  \subsection{The \Operator Class}
1344  The \Operator class provides an abstract access to operators build  The \Operator class provides an abstract access to operators build
1345  within the \LinearPDE class. \Operator objects are created  within the \LinearPDE class. \Operator objects are created
1346  when a PDE is handed over to a PDE solver library and handled  when a PDE is handed over to a PDE solver library and handled
1347  by the \LinearPDE object defining the PDE. The user can gain access  by the \LinearPDE object defining the PDE. The user can gain access
1348  to the \Operator of a \LinearPDE object through the \var{getOperator}  to the \Operator of a \LinearPDE object through the \var{getOperator}
# Line 1388  w=30*kg Line 1386  w=30*kg
1386  w2=40*lb  w2=40*lb
1387  T=100*Celsius  T=100*Celsius
1388  \end{python}  \end{python}
1389  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  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
1390  composed units can be used, for instance  composed units can be used, for instance
1391  \begin{python}  \begin{python}
1392  from esys.escript.unitsSI import *  from esys.escript.unitsSI import *
1393  rho=40*lb/cm**3  rho=40*lb/cm**3
1394  \end{python}  \end{python}
1395  to define the density in the units of pounds per cubic centimeter. The value $40$ will be converted  to define the density in the units of pounds per cubic centimeter. The value $40$ will be converted
1396  into SI units, in this case kg per cubic meter.  into SI units, in this case kg per cubic meter.
1397  Moreover unit prefixes are supported:  Moreover unit prefixes are supported:
1398  \begin{python}  \begin{python}
# Line 1407  a desired unit, e.g Line 1405  a desired unit, e.g
1405  from esys.escript.unitsSI import *  from esys.escript.unitsSI import *
1406  print p/atm  print p/atm
1407  \end{python}  \end{python}
1408  can be used print the pressure in units of atmosphere\index{atmosphere}.    can be used print the pressure in units of atmosphere\index{atmosphere}.
1409    
1410  This is an incomplete list of supported physical units:  This is an incomplete list of supported physical units:
1411    
# Line 1436  unit of centi meter Line 1434  unit of centi meter
1434  \end{datadesc}  \end{datadesc}
1435    
1436  \begin{datadesc}{h}  \begin{datadesc}{h}
1437  unit of hour  unit of hour
1438  \end{datadesc}  \end{datadesc}
1439  \begin{datadesc}{day}  \begin{datadesc}{day}
1440  unit of day  unit of day
1441  \end{datadesc}  \end{datadesc}
1442  \begin{datadesc}{yr}  \begin{datadesc}{yr}
1443   unit of year   unit of year
# Line 1452  unit of gram Line 1450  unit of gram
1450  unit of kilo gram  unit of kilo gram
1451   \end{datadesc}   \end{datadesc}
1452  \begin{datadesc}{lb}  \begin{datadesc}{lb}
1453  unit of pound  unit of pound
1454  \end{datadesc}  \end{datadesc}
1455  \begin{datadesc}{ton}  \begin{datadesc}{ton}
1456   metric ton   metric ton
# Line 1470  unit of pound Line 1468  unit of pound
1468   unit of Newton   unit of Newton
1469  \end{datadesc}  \end{datadesc}
1470  \begin{datadesc}{Pa}  \begin{datadesc}{Pa}
1471  unit of Pascal  unit of Pascal
1472  \end{datadesc}  \end{datadesc}
1473  \begin{datadesc}{atm}  \begin{datadesc}{atm}
1474  unit of atmosphere  unit of atmosphere
1475  \end{datadesc}  \end{datadesc}
1476  \begin{datadesc}{J}  \begin{datadesc}{J}
1477  unit of Joule  unit of Joule
1478  \end{datadesc}  \end{datadesc}
1479    
1480  \begin{datadesc}{W}  \begin{datadesc}{W}
1481  unit of Watt  unit of Watt
1482  \end{datadesc}  \end{datadesc}
1483    
1484  \begin{datadesc}{C}  \begin{datadesc}{C}
1485  unit of Coulomb  unit of Coulomb
1486  \end{datadesc}  \end{datadesc}
1487  \begin{datadesc}{V}  \begin{datadesc}{V}
1488  unit of Volt  unit of Volt
1489  \end{datadesc}  \end{datadesc}
1490  \begin{datadesc}{F}  \begin{datadesc}{F}
1491   unit of Farad   unit of Farad
1492  \end{datadesc}  \end{datadesc}
1493    
1494  \begin{datadesc}{Ohm}  \begin{datadesc}{Ohm}
1495   unit of Ohm   unit of Ohm
1496  \end{datadesc}  \end{datadesc}
1497  \begin{datadesc}{K}  \begin{datadesc}{K}
1498  unit of Kelvin  unit of Kelvin
1499  \end{datadesc}  \end{datadesc}
1500  \begin{datadesc}{Celsius}  \begin{datadesc}{Celsius}
1501   unit of Celsius   unit of Celsius
1502  \end{datadesc}  \end{datadesc}
1503    
1504  \begin{datadesc}{Fahrenheit}  \begin{datadesc}{Fahrenheit}
1505  unit of Fahrenheit  unit of Fahrenheit
1506  \end{datadesc}  \end{datadesc}
1507    
1508  Moreover unit prefixes are supported:  Moreover unit prefixes are supported:
1509    
1510  \begin{datadesc}{Yotta}  \begin{datadesc}{Yotta}
1511  prefix yotta = $10^{24}$.  prefix yotta = $10^{24}$.
1512    
1513  \end{datadesc}  \end{datadesc}
1514    
1515  \begin{datadesc}{Zetta}  \begin{datadesc}{Zetta}
# Line 1555  prefix deci= $10^{-1}$. Line 1553  prefix deci= $10^{-1}$.
1553   \end{datadesc}   \end{datadesc}
1554    
1555  \begin{datadesc}{Centi}  \begin{datadesc}{Centi}
1556  prefix centi= $10^{-2}$.  prefix centi= $10^{-2}$.
1557  \end{datadesc}  \end{datadesc}
1558    
1559  \begin{datadesc}{Milli}  \begin{datadesc}{Milli}
# Line 1593  prefix yocto= $10^{-24}$. Line 1591  prefix yocto= $10^{-24}$.
1591    
1592  \section{Utilities}  \section{Utilities}
1593    
1594  The \class{FileWriter} provides a mechanism to write data to a file.  The \class{FileWriter} provides a mechanism to write data to a file.
1595  In essence, this class wraps the standard \class{file} class to write data  In essence, this class wraps the standard \class{file} class to write data
1596  that are global in MPI to a file. In fact, data are written on the processor  that are global in MPI to a file. In fact, data are written on the processor
1597  with \MPI rank 0 only. It is recommended to use \class{FileWriter}  with \MPI rank 0 only. It is recommended to use \class{FileWriter}
1598  rather than \class{open} in order to write code that is running  rather than \class{open} in order to write code that is running
1599  with and without \MPI. It is save to use \class{open} under MPI to read data which are global under \MPI.  with and without \MPI. It is save to use \class{open} under MPI to read data which are global under \MPI.
1600    
1601  \begin{classdesc}{FileWriter}{fn\optional{,append=\False, \optional{createLocalFiles=\False}})}  \begin{classdesc}{FileWriter}{fn\optional{,append=\False, \optional{createLocalFiles=\False}})}
1602  Opens a file of name \var{fn} for writing. If \var{append} is set to \True  Opens a file of name \var{fn} for writing. If \var{append} is set to \True
1603  written data are append at the end of the file.  written data are append at the end of the file.
1604  If running under \MPI only the first processor with rank==0  If running under \MPI only the first processor with rank==0
1605  will open the file and write to it.  will open the file and write to it.
1606  If \var{createLocalFiles} is set each individual processor will create a file  If \var{createLocalFiles} is set each individual processor will create a file
1607  where for any processor with rank>0 the file name is extended by its rank. This option is normally used for debug purposes only.  where for any processor with rank>0 the file name is extended by its rank. This option is normally used for debug purposes only.
1608  \end{classdesc}  \end{classdesc}
# Line 1622  Note that newline is not added. Line 1620  Note that newline is not added.
1620  \end{methoddesc}  \end{methoddesc}
1621  \begin{methoddesc}[FileWriter]{writelines}{txts}  \begin{methoddesc}[FileWriter]{writelines}{txts}
1622  Write the list \var{txts} of strings to the file..  Write the list \var{txts} of strings to the file..
1623  Note that newlines are not added.  Note that newlines are not added.
1624  This method is equivalent to call write() for each string.  This method is equivalent to call write() for each string.
1625  \end{methoddesc}  \end{methoddesc}
1626  \begin{memberdesc}[FileWriter]{closed}  \begin{memberdesc}[FileWriter]{closed}
1627  \True if file is closed.  \True if file is closed.
1628  \end{memberdesc}  \end{memberdesc}
1629  \begin{memberdesc}[FileWriter]{mode}  \begin{memberdesc}[FileWriter]{mode}
1630  access mode.  access mode.
1631  \end{memberdesc}  \end{memberdesc}
1632  \begin{memberdesc}[FileWriter]{name}  \begin{memberdesc}[FileWriter]{name}
1633  file name.  file name.
# Line 1641  line separator Line 1639  line separator
1639    
1640  \begin{funcdesc}{setEscriptParamInt}{name,value}  \begin{funcdesc}{setEscriptParamInt}{name,value}
1641  assigns the integer value \var{value} to the parameter \var{name}.  assigns the integer value \var{value} to the parameter \var{name}.
1642  If \var{name}="TOO_MANY_LINES" conversion of any \Data object to a string switches to a  If \var{name}="TOO_MANY_LINES" conversion of any \Data object to a string switches to a
1643  condensed format if more than \var{value} lines would be created.  condensed format if more than \var{value} lines would be created.
1644  \end{funcdesc}  \end{funcdesc}
1645    
1646  \begin{funcdesc}{getEscriptParamInt}{name}  \begin{funcdesc}{getEscriptParamInt}{name}
1647  returns the current value of integer parameter \var{name}.  returns the current value of integer parameter \var{name}.
1648  \end{funcdesc}  \end{funcdesc}
1649    
1650  \begin{funcdesc}{listEscriptParams}{a}  \begin{funcdesc}{listEscriptParams}{a}
# Line 1666  performs a barrier synchronization acros Line 1664  performs a barrier synchronization acros
1664  processor group.  processor group.
1665  \end{funcdesc}  \end{funcdesc}
1666  \begin{funcdesc}{getMPIWorldMax}{a}  \begin{funcdesc}{getMPIWorldMax}{a}
1667  returns the maximum value of the integer \var{a} across all  returns the maximum value of the integer \var{a} across all
1668  processors within \env{MPI_COMM_WORLD}.  processors within \env{MPI_COMM_WORLD}.
1669  \end{funcdesc}  \end{funcdesc}
1670    

Legend:
Removed from v.3295  
changed lines
  Added in v.3296

  ViewVC Help
Powered by ViewVC 1.1.26