/[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 593 by gross, Tue Mar 14 02:50:27 2006 UTC revision 599 by gross, Fri Mar 17 05:48:59 2006 UTC
# Line 7  Line 7 
7  \modulesynopsis{Data manipulation}  \modulesynopsis{Data manipulation}
8    
9  \begin{figure}  \begin{figure}
10  \includegraphics[width=\textwidth]{EscriptDiagram1.eps}  \includegraphics[width=\textwidth]{figures/EscriptDiagram1.eps}
11  \caption{\label{ESCRIPT DEP}Dependency of Function Spaces. An arrow indicates that a function in the  \caption{\label{ESCRIPT DEP}Dependency of Function Spaces. An arrow indicates that a function in the
12  function space at the starting point can be interpreted as a function in the function space of the arrow target.}  function space at the starting point can be interpreted as a function in the function space of the arrow target.}
13  \end{figure}  \end{figure}
# Line 41  solution_space=Solution(mydomain) Line 41  solution_space=Solution(mydomain)
41  \end{python}  \end{python}
42  The following generators for function spaces on a \Domain \var{mydomain} are available:  The following generators for function spaces on a \Domain \var{mydomain} are available:
43  \begin{itemize}  \begin{itemize}
44  \item \var{Solution(mydomain)}: solutions of a PDE.    \item \var{Solution(mydomain)}: solutions of a PDE.
45    \item \var{ReducedSolution(mydomain)}: solutions of a PDE with a reduced smoothness requirement.  
46  \item \var{ContinuousFunction(mydomain)}: continuous functions, eg. a temperature distribution.  \item \var{ContinuousFunction(mydomain)}: continuous functions, eg. a temperature distribution.
47  \item \var{Function(mydomain)}: general functions which are not necessarily continuous, eg. a stress field.  \item \var{Function(mydomain)}: general functions which are not necessarily continuous, eg. a stress field.
48  \item \var{FunctionOnBoundary(mydomain)}: functions on the boundary of the domain, eg. a surface pressure.  \item \var{FunctionOnBoundary(mydomain)}: functions on the boundary of the domain, eg. a surface pressure.
49  \item \var{FunctionOnContact0(mydomain)}: functions on side $0$ of the discontinuity.  \item \var{FunctionOnContact0(mydomain)}: functions on side $0$ of the discontinuity.
50  \item \var{FunctionOnContact1(mydomain)}: functions on side $1$ of the discontinuity.  \item \var{FunctionOnContact1(mydomain)}: functions on side $1$ of the discontinuity.
51  \end{itemize}  \end{itemize}
52    The reduced smoothness for PDE solution is often used to fulfill the Ladyzhenskaya–-Babuska–-Brezzi condition \cite{LBB} when
53    solving saddle point problems \index{saddle point problems}, eg. the Stokes equation.
54  A discontinuity \index{discontinuity} is a region within the domain across which functions may be discontinuous.    A discontinuity \index{discontinuity} is a region within the domain across which functions may be discontinuous.  
55  The location of discontinuity is defined in the \Domain object.  The location of discontinuity is defined in the \Domain object.
56  \fig{ESCRIPT DEP} shows the dependency between the types of function spaces.  \fig{ESCRIPT DEP} shows the dependency between the types of function spaces.
# Line 161  $\lambda$ and $\mu$ are the Lame coeffic Line 164  $\lambda$ and $\mu$ are the Lame coeffic
164  takes the displacement {\tt u} and the Lame coefficients  takes the displacement {\tt u} and the Lame coefficients
165  \var{lam} and \var{mu} as arguments and returns the corresponding stress:  \var{lam} and \var{mu} as arguments and returns the corresponding stress:
166  \begin{python}  \begin{python}
167  import numarray  from esys.escript import *
168  def getStress(u,lam,mu):  def getStress(u,lam,mu):
169    d=u.getDomain().getDim()    d=u.getDomain().getDim()
170    g=grad(u)    g=grad(u)
171    stress=lam*trace(g)*numarray.identity(d)+ \    stress=lam*trace(g)*kronecker(d)+mu*(g+transpose(g))
                                  mu*(g+transpose(g))  
172    return stress        return stress    
173  \end{python}  \end{python}
174  The variable  The variable
175  \var{d} gives the spatial dimension of the  \var{d} gives the spatial dimension of the
176  domain on which the displacements are defined.  domain on which the displacements are defined.
177  \var{identity} is a \numarray function which returns the Kronecker symbol with indexes  \var{kronecker} returns the Kronecker symbol with indexes
178  $i$ and $j$ running from $0$ to \var{d}-1. The call \var{grad(u)} requires  $i$ and $j$ running from $0$ to \var{d}-1. The call \var{grad(u)} requires
179  the displacement field \var{u} to be in the \var{Solution} or \ContinuousFunction  the displacement field \var{u} to be in the \var{Solution} or \ContinuousFunction
180  function space. The result \var{g} as well as the returned stress will be in the \Function function space.  function space. The result \var{g} as well as the returned stress will be in the \Function function space.
# Line 204  In the context of FEM this means the nod Line 206  In the context of FEM this means the nod
206  \escript calls the appropriate function from the PDE solver library.  \escript calls the appropriate function from the PDE solver library.
207    
208  \begin{figure}  \begin{figure}
209  \includegraphics[width=\textwidth]{EscriptDiagram2.eps}  \includegraphics[width=\textwidth]{figures/EscriptDiagram2.eps}
210  \caption{\label{Figure: tag}Element Tagging. A rectangular mesh over a region with two rock types {\it white} and {\it gray}.  \caption{\label{Figure: tag}Element Tagging. A rectangular mesh over a region with two rock types {\it white} and {\it gray}.
211  The number in each cell refers to the major rock type present in the cell ($1$ for {\it white} and $2$ for {\it gray}).  The number in each cell refers to the major rock type present in the cell ($1$ for {\it white} and $2$ for {\it gray}).
212  }  }
# Line 213  The number in each cell refers to the ma Line 215  The number in each cell refers to the ma
215  Material parameters such as the Lame coefficients are typically dependent on rock types present in the  Material parameters such as the Lame coefficients are typically dependent on rock types present in the
216  area of interest. A common technique to handle these kinds of material parameters is "tagging". \fig{Figure: tag}  area of interest. A common technique to handle these kinds of material parameters is "tagging". \fig{Figure: tag}
217  shows an example. In this case two rock types {\it white} and {\it gray} can be found in the domain. The domain  shows an example. In this case two rock types {\it white} and {\it gray} can be found in the domain. The domain
218  is subdivided into rectangular shaped cells (which is not necessarily the best subdivision for this case). Each  is subdivided into triangular shaped cells. Each
219  cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate  cell has a tag indicating the rock type predominately found in this cell. Here $1$ is used to indicate
220  rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated  rock type {\it white} and $2$ for rock type {\it gray}. The tags are assigned at the time when the cells are generated
 (\escript provides tools to manipulate tags at a later stage)  
221  and stored in the \Domain class object. The following statements show how for the  and stored in the \Domain class object. The following statements show how for the
222  example of \fig{Figure: tag} and the stress calculation discussed before tagged values are used for  example of \fig{Figure: tag} and the stress calculation discussed before tagged values are used for
223  \var{lam}:  \var{lam}:
# Line 236  translations between them. As shown in t Line 237  translations between them. As shown in t
237  develop and test algorithms for a simple case (for instance with the Lame coefficients as constants)  develop and test algorithms for a simple case (for instance with the Lame coefficients as constants)
238  and then without further modifications of the program code to apply the algorithm in a  and then without further modifications of the program code to apply the algorithm in a
239  more complex application (for instance a definition of the Lame coefficients using tags).  more complex application (for instance a definition of the Lame coefficients using tags).
240  As described here, there are three ways in which \Data objects are represented internally, constant, tagged, and expanded (other representions will become available in later versions of \escript):  As described here, there are three ways in which \Data objects are represented internally, constant,
241    tagged, and expanded (other representations will become available in later versions of \escript):
242  In the constant case, if the same value is used at each sample point a single value is stored to save memory and compute time.  In the constant case, if the same value is used at each sample point a single value is stored to save memory and compute time.
243  Any operation on this constant data will only be performed on the single value.  Any operation on this constant data will only be performed on the single value.
244  In the expanded case, each sample point has an individual value, eg. the solution of a PDE,  In the expanded case, each sample point has an individual value, eg. the solution of a PDE,
# Line 248  held in a dictionary. Operations on tagg Line 250  held in a dictionary. Operations on tagg
250  processing the value for each individual sample point.  processing the value for each individual sample point.
251  \escript allows use of constant, tagged and expanded data in a single expression.  \escript allows use of constant, tagged and expanded data in a single expression.
252    
   
   
253  \section{\Domain class}  \section{\Domain class}
254  \begin{classdesc}{Domain}{}  \begin{classdesc}{Domain}{}
255  A \Domain object is used to describe a geometrical region together with  A \Domain object is used to describe a geometrical region together with
# Line 562  returns a string representation of the o Line 562  returns a string representation of the o
562  \section{Functions of \Data class objects}  \section{Functions of \Data class objects}
563  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}.
564  A complete list and a more detailed description of the functionality can be fond on \ReferenceGuide.  A complete list and a more detailed description of the functionality can be fond on \ReferenceGuide.
565  \begin{funcdesc}{saveVTK}{filename,\optional{domain},**data}  \begin{funcdesc}{saveVTK}{filename,**kwdata}
566  writes a  writes \Data defined by keywords in the file with \var{filename} using the
567  \end{funcdesc}  vtk file format \VTK file format. The key word is used as an identifier. The statement
568  \begin{funcdesc}{saveDX}{filename,domain=None,**data}  \begin{python}
569    saveVTK("out.xml",temperature=T,velocity=v)
570    \end{python}
571    will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the
572    file \file{out.xml}. Restrictions on the allowed combinations of \FunctionSpace apply.
573    \end{funcdesc}
574    \begin{funcdesc}{saveDX}{filename,**kwdata}
575    writes \Data defined by keywords in the file with \var{filename} using the
576    vtk file format \OpenDX file format. The key word is used as an identifier. The statement
577    \begin{python}
578    saveDX("out.dx",temperature=T,velocity=v)
579    \end{python}
580    will write the scalar \var{T} as \var{temperature} and the vector \var{v} as  \var{velocity} into the
581    file \file{out.dx}. Restrictions on the allowed combinations of \FunctionSpace apply.
582  \end{funcdesc}  \end{funcdesc}
583  \begin{funcdesc}{kronecker}{d}  \begin{funcdesc}{kronecker}{d}
584  returns a \RankTwo \Data object \var{o} in \FunctionSpace \var{d} such that  returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
585  \begin{equation}  \begin{equation}
586  o\left[ i,j\right] = \left\{  \code{kronecker(d)}\left[ i,j\right] = \left\{
587  \begin{array}{cc}  \begin{array}{cc}
588  1 & \mbox{ if } i=j \\  1 & \mbox{ if } i=j \\
589  0 & \mbox{ otherwise }  0 & \mbox{ otherwise }
590  \end{array}  \end{array}
591  \right.  \right.
592  \end{equation}  \end{equation}
593    If \var{d} is an integer a $(d,d)$ \numarray array is returned.
594  \end{funcdesc}  \end{funcdesc}
   
595  \begin{funcdesc}{identityTensor}{d}  \begin{funcdesc}{identityTensor}{d}
596    returns a \RankTwo \Data object in \FunctionSpace \var{d} such that
597    \begin{equation}
598    \code{identityTensor(d)}\left[ i,j\right] = \left\{
599    \begin{array}{cc}
600    1 & \mbox{ if } i=j \\
601    0 & \mbox{ otherwise }
602    \end{array}
603    \right.
604    \end{equation}
605    If \var{d} is an integer a $(d,d)$ \numarray array is returned.
606  \end{funcdesc}  \end{funcdesc}
607  \begin{funcdesc}{identityTensor4}{d}  \begin{funcdesc}{identityTensor4}{d}
608    returns a \RankFour \Data object in \FunctionSpace \var{d} such that
609    \begin{equation}
610    \code{identityTensor(d)}\left[ i,j,k,l\right] = \left\{
611    \begin{array}{cc}
612    1 & \mbox{ if } i=k \mbox{ and } j=l\\
613    0 & \mbox{ otherwise }
614    \end{array}
615    \right.
616    \end{equation}
617    If \var{d} is an integer a $(d,d,d,d)$ \numarray array is returned.
618  \end{funcdesc}  \end{funcdesc}
619  \begin{funcdesc}{unitVector}{i,d}  \begin{funcdesc}{unitVector}{i,d}
620    returns a \RankOne \Data object in \FunctionSpace \var{d} such that
621    \begin{equation}
622    \code{identityTensor(d)}\left[ j \right] = \left\{
623    \begin{array}{cc}
624    1 & \mbox{ if } j=i\\
625    0 & \mbox{ otherwise }
626    \end{array}
627    \right.
628    \end{equation}
629    If \var{d} is an integer a $(d,)$ \numarray array is returned.
630    
631  \end{funcdesc}  \end{funcdesc}
632    
633  \begin{funcdesc}{Lsup}{a}  \begin{funcdesc}{Lsup}{a}
# Line 656  applies square root function to \var{a}. Line 700  applies square root function to \var{a}.
700  \end{funcdesc}  \end{funcdesc}
701    
702  \begin{funcdesc}{log}{a}  \begin{funcdesc}{log}{a}
703    applies the natural logarithm to \var{a}.
704  \end{funcdesc}  \end{funcdesc}
705    
706  \begin{funcdesc}{log10}{a}  \begin{funcdesc}{log10}{a}
707    applies the base-$10$ logarithm to \var{a}.
708  \end{funcdesc}  \end{funcdesc}
709    
710  \begin{funcdesc}{sign}{a}  \begin{funcdesc}{sign}{a}
711    applies the sign function to \var{a}, that is $1$ where \var{a} is positive,
712    $-1$ where \var{a} is negative and $0$ otherwise.
713  \end{funcdesc}  \end{funcdesc}
714    
715  \begin{funcdesc}{wherePositive}{a}  \begin{funcdesc}{wherePositive}{a}
716    returns a function which is $1$ where \var{a} is positive and $0$ otherwise.
717  \end{funcdesc}  \end{funcdesc}
718    
719  \begin{funcdesc}{whereNegative}{a}  \begin{funcdesc}{whereNegative}{a}
720    returns a function which is $1$ where \var{a} is negative and $0$ otherwise.
721  \end{funcdesc}  \end{funcdesc}
722    
723  \begin{funcdesc}{whereNonNegative}{a}  \begin{funcdesc}{whereNonNegative}{a}
724    returns a function which is $1$ where \var{a} is non--negative and $0$ otherwise.
725  \end{funcdesc}  \end{funcdesc}
726    
727  \begin{funcdesc}{whereNonPositive}{a}  \begin{funcdesc}{whereNonPositive}{a}
728    returns a function which is $1$ where \var{a} is non--positive and $0$ otherwise.
729  \end{funcdesc}  \end{funcdesc}
730  \begin{funcdesc}{whereZero}{a,tol=0.}  
731    \begin{funcdesc}{whereZero}{a\optional{, tol=0.}}
732    returns a function which is $1$ where \var{a} equals zero with tolerance \var{tol} and $0$ otherwise.
733  \end{funcdesc}  \end{funcdesc}
734  \begin{funcdesc}{whereNonZero}{a,tol=0.}  
735    \begin{funcdesc}{whereNonZero}{a\optional{, tol=0.}}
736    returns a function which is $1$ where \var{a} different from zero with tolerance \var{tol} and $0$ otherwise.
737  \end{funcdesc}  \end{funcdesc}
738    
739  \begin{funcdesc}{minval}{a}  \begin{funcdesc}{minval}{a}
740    returns at each \DataSamplePoints the minumum value over all components.
741  \end{funcdesc}  \end{funcdesc}
742    
743  \begin{funcdesc}{maxval}{a}  \begin{funcdesc}{maxval}{a}
744    returns at each \DataSamplePoints the maximum value over all components.
745  \end{funcdesc}  \end{funcdesc}
746    
747  \begin{funcdesc}{length}{a}  \begin{funcdesc}{length}{a}
748    returns at Euclidean norm at each \DataSamplePoints. For a \RankFour function \var{a} this is
749    \begin{equation}
750    \code{length(a)}=\sqrt{\sum\hackscore{ijkl} \var{a} \left[i,j,k,l\right]^2}
751    \end{equation}
752  \end{funcdesc}  \end{funcdesc}
753  \begin{funcdesc}{trace}{a,axis_offset=0}  \begin{funcdesc}{trace}{a\optional{,axis_offset=0}}
754    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
755    case of a \RankTwo function and this is
756    \begin{equation}
757    \code{trace(a)}=\sum\hackscore{i} \var{a} \left[i,i\right]
758    \end{equation}
759    and for a \RankFour function and  \code{axis_offset=1} this is
760    \begin{equation}
761    \code{trace(a,1)}\left[i,j\right]=\sum\hackscore{k} \var{a} \left[i,k,k,j\right]
762    \end{equation}
763  \end{funcdesc}  \end{funcdesc}
764  \begin{funcdesc}{transpose}{a,axis_offset=None}  \begin{funcdesc}{transpose}{a\optional{, axis_offset=None}}
765    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
766    present \code{int(r/2)} is used where \var{r} is the rank of \var{a}.
767     the sum over components \var{axis_offset} and \var{axis_offset+1} with the same index. For instance in the
768    case of a \RankTwo function and this is
769    \begin{equation}
770    \code{transpose(a)}\left[i,j\right]=\var{a} \left[j,i\right]
771    \end{equation}
772    and for a \RankFour function and  \code{axis_offset=1} this is
773    \begin{equation}
774    \code{transpose(a,1)}\left[i,j,k,l\right]=\var{a} \left[j,k,l,i\right]
775    \end{equation}
776  \end{funcdesc}  \end{funcdesc}
777  \begin{funcdesc}{symmetric}{a}  \begin{funcdesc}{symmetric}{a}
778    returns the symmetric part of \var{a}. This is \code{(a+transpose(a))/2}.
779  \end{funcdesc}  \end{funcdesc}
780  \begin{funcdesc}{nonsymmetric}{a}  \begin{funcdesc}{nonsymmetric}{a}
781    returns the non--symmetric part of \var{a}. This is \code{(a-transpose(a))/2}.
782  \end{funcdesc}  \end{funcdesc}
783  \begin{funcdesc}{inverse}{a}  \begin{funcdesc}{inverse}{a}
784    return the inverse of \var{a}. This is
785    \begin{equation}
786    \code{matrixmult(inverse(a),a)=kronecker(d)}
787    \end{equation}
788    if \var{a} has shape \code{(d,d)}. The current implementation is restricted to arguments of shape
789    \code{(2,2)} and \code{(3,3)}.
790  \end{funcdesc}  \end{funcdesc}
791  \begin{funcdesc}{eigenvalues}{a}  \begin{funcdesc}{eigenvalues}{a}
792    return the eigenvalues of \var{a}. This is
793    \begin{equation}
794    \code{matrixmult(a,V)=e[i]*V}
795    \end{equation}
796    where \code{e=eigenvalues(a)} and \var{V} is suitable non--zero vector \var{V}.
797    The eigenvalues are ordered in increasing size.
798    The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.  
799    The current implementation is restricted to arguments of shape
800    \code{(2,2)} and \code{(3,3)}.
801  \end{funcdesc}  \end{funcdesc}
802  \begin{funcdesc}{eigenvalues_and_eigenvectors}{a}  \begin{funcdesc}{eigenvalues_and_eigenvectors}{a}
803    return the eigenvalues and eigenvectors of \var{a}. This is
804    \begin{equation}
805    \code{matrixmult(a,V[:,i])=e[i]*V[:,i]}
806    \end{equation}
807    where \code{e,V=eigenvalues_and_eigenvectors(a)}. The eigenvectors \var{V} are orthogonal and normalized, ie.
808    \begin{equation}
809    \code{matrixmult(transpose(V),V)=kronecker(d)}
810    \end{equation}
811    if \var{a} has shape \code{(d,d)}. The eigenvalues are ordered in increasing size.
812    The argument \var{a} has to be the symmetric, ie. \code{a=symmetric(a)}.  
813    The current implementation is restricted to arguments of shape
814    \code{(2,2)} and \code{(3,3)}.
815    \end{funcdesc}
816    \begin{funcdesc}{maximum}{*a}
817    returns the maximum value over all arguments at all \DataSamplePoints and for each component.
818    For instance
819    \begin{equation}
820    \code{maximum(a0,a1)}\left[i,j\right]=max(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
821    \end{equation}
822    at all \DataSamplePoints.
823  \end{funcdesc}  \end{funcdesc}
824  \begin{funcdesc}{maximum}{a}  \begin{funcdesc}{minimum}{*a}
825  \end{funcdesc}  returns the minimum value over all arguments at all \DataSamplePoints and for each component.
826  \begin{funcdesc}{minimum}{a}  For instance
827    \begin{equation}
828    \code{minimum(a0,a1)}\left[i,j\right]=min(\var{a0} \left[i,j\right],\var{a1} \left[i,j\right])
829    \end{equation}
830    at all \DataSamplePoints.
831  \end{funcdesc}  \end{funcdesc}
832  \begin{funcdesc}{clip}{a,minval=0.,maxval=1.}  
833    \begin{funcdesc}{clip}{a\optional{, minval=0.}\optional{, maxval=1.}}
834    cuts back \var{a} into the range between \var{minval} and \var{maxval}. A value in the returned object equals
835    \var{minval} if the corresponding value of \var{a} is less than \var{minval}, equals \var{maxval} if the
836     corresponding value of \var{a} is greater than \var{maxval}
837    or corresponding value of \var{a} otherwise.
838  \end{funcdesc}  \end{funcdesc}
839  \begin{funcdesc}{inner}{a0,a1}  \begin{funcdesc}{inner}{a0,a1}
840    returns the inner product of \var{a0} and \var{a1}. For instance in the
841    case of \RankTwo arguments and this is
842    \begin{equation}
843    \code{inner(a)}=\sum\hackscore{ij}\var{a0} \left[j,i\right]  \cdot \var{a1} \left[j,i\right]
844    \end{equation}
845    and for a \RankFour arguments this is
846    \begin{equation}
847    \code{inner(a)}=\sum\hackscore{ijkl}\var{a0} \left[i,j,k,l\right]  \cdot \var{a1} \left[j,i,k,l\right]
848    \end{equation}
849  \end{funcdesc}  \end{funcdesc}
850  \begin{funcdesc}{matrixmult}{a0,a1}  \begin{funcdesc}{matrixmult}{a0,a1}
851    returns the matrix product of \var{a0} and \var{a1}. If \var{a1} is \RankOne this is
852    \begin{equation}
853    \code{matrixmult(a)}\left[i\right]=\sum\hackscore{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k\right]
854    \end{equation}
855    and if \var{a1} is \RankTwo this is
856    \begin{equation}
857    \code{matrixmult(a)}\left[i,j\right]=\sum\hackscore{k}\var{a0}  \cdot \left[i,k\right]\var{a1} \left[k,j\right]
858    \end{equation}
859  \end{funcdesc}  \end{funcdesc}
860  \begin{funcdesc}{outer}{a0,a1}  \begin{funcdesc}{outer}{a0,a1}
861    returns the outer product of \var{a0} and \var{a1}. For instance if \var{a0} and \var{a1} both are \RankOne then
862    \begin{equation}
863    \code{outer(a)}\left[i,j\right]=\var{a0} \left[i\right]  \cdot  \var{a1}\left[j\right]
864    \end{equation}
865    and if \var{a0} is \RankOne and \var{a1} is \RankThree
866    \begin{equation}
867    \code{outer(a)}\left[i,j,k\right]=\var{a0} \left[i\right] \cdot \var{a1}\left[j,k\right]
868    \end{equation}
869  \end{funcdesc}  \end{funcdesc}
870  \begin{funcdesc}{tensormult}{a0,a1}  \begin{funcdesc}{tensormult}{a0,a1}
871    returns the tensor product of \var{a0} and \var{a1}. If \var{a1} is \RankTwo this is
872    \begin{equation}
873    \code{tensormult(a)}\left[i,j\right]=\sum\hackscore{kl}\var{a0}\left[i,j,k,l\right] \cdot \var{a1} \left[k,l\right]
874    \end{equation}
875    and if \var{a1} is \RankFour this is
876    \begin{equation}
877    \code{tensormult(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]
878    \end{equation}
879  \end{funcdesc}  \end{funcdesc}
880  \begin{funcdesc}{grad}{a,where=None}  \begin{funcdesc}{grad}{a\optional{, where=None}}
881    returns the gradient of \var{a}. If \var{where} is present the gradient will be calculated in \FunctionSpace \var{where} otherwise a
882    default \FunctionSpace is used. In case that \var{a} has \RankTwo one has
883    \begin{equation}
884    \code{grad(a)}\left[i,j,k\right]=\frac{\partial \var{a} \left[i,j\right]}{\partial x\hackscore{k}}
885    \end{equation}
886  \end{funcdesc}  \end{funcdesc}
887  \begin{funcdesc}{integrate}{a,where=None}  \begin{funcdesc}{integrate}{a\optional{ ,where=None}}
888    returns the integral of \var{a} where the domain of integration is defined by the \FunctionSpace of \var{a}. If \var{where} is
889    present the argument is interpolated into \FunctionSpace \var{where} before integration. For instance in the case of
890    a \RankTwo argument in \ContinuousFunction it is
891    \begin{equation}
892    \code{integrate(a)}\left[i,j\right]=\int\hackscore{\Omega}\var{a} \left[i,j\right] \; d\Omega
893    \end{equation}
894    where $\Omega$ is the spatial domain and $d\Omega$ volume integration. To integrate over the boundary of the domain one uses  
895    \begin{equation}
896    \code{integrate(a,where=FunctionOnBoundary(a.getDomain))}\left[i,j\right]=\int\hackscore{\partial \Omega} a\left[i,j\right] \; ds
897    \end{equation}
898    where $\partial \Omega$ is the surface of the spatial domain and $ds$ area or line integration.
899  \end{funcdesc}  \end{funcdesc}
900  \begin{funcdesc}{interpolate}{a,where}  \begin{funcdesc}{interpolate}{a,where}
901    interpolates argument \var{a} into the \FunctionSpace \var{where}.
902  \end{funcdesc}  \end{funcdesc}
903  \begin{funcdesc}{div}{a,where=None}  \begin{funcdesc}{div}{a\optional{ ,where=None}}
904    returns the divergence of \var{a}. This
905    \begin{equation}
906    \code{div(a)}=trace(grad(a),where)
907    \end{equation}
908  \end{funcdesc}  \end{funcdesc}
909  \begin{funcdesc}{jump}{a,domain=None}  \begin{funcdesc}{jump}{a\optional{ ,domain=None}}
910    returns the jump of \var{a} over the discontinuity in its domain or if \Domain \var{domain} is present
911    in \var{domain}.
912    \begin{equation}
913    \code{jump(a)}=interpolate(a,FunctionOnContactOne(domain))-interpolate(a,FunctionOnContactZero(domain))
914    \end{equation}
915  \end{funcdesc}  \end{funcdesc}
916  \begin{funcdesc}{L2}{a}  \begin{funcdesc}{L2}{a}
917    returns the $L^2$-norm of \var{a} in its function space. This is
918    \begin{equation}
919    \code{L2(a)}=integrate(length(a)^2) \; .
920    \end{equation}
921  \end{funcdesc}  \end{funcdesc}
922    
 ====  
   
   
 \begin{funcdesc}{wherePositive}{a}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is positive and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{wherePositive}{a}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is non-positive and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{whereNonnegative}{a}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is non-negative and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{whereNegative}{a}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is negative and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{whereZero}{a,tol=1.e-8}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is nearly zero, i.e. where the absolute value is less  
 than \var{tolerance}, and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{whereNonzero}{tolerance=1.e-8}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is nearly non-zero, i.e. where the absolute value is  
 greater or equal than \var{tolerance}, and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sign}{a}  
 returns \Data object which has the same \Shape and is defined on  
 the same \FunctionSpace like the object. The returned values are $1$  
 where the object is positive, $-1$ where the value is negative and $0$ elsewhere.  
 \end{funcdesc}  
   
 \begin{funcdesc}{Lsup}{a}  
 returns the $L^{sup}$-norm of the object. This is maximum absolute values over all components and all \DataSamplePoints. \index{$L^{sup}$-norm}.  
 \end{funcdesc}  
 \begin{funcdesc}{Linf}{a}  
 returns the minimum absolute value over all components and all \DataSamplePoints. \index{$L^{inf}$-norm}.  
 \end{funcdesc}  
 \begin{funcdesc}{inf}{a}  
 returns the minimum value (infimum) of the object. The minimum is  
 taken over all components and all \DataSamplePoints .  \index{infimum}  
 \end{funcdesc}  
   
 \begin{funcdesc}{sup}{a}  
 returns the maximum value (supremum) of the object. The maximum is  
 taken over all components and all \DataSamplePoints .  \index{supremum}  
 \end{funcdesc}  
   
 \begin{funcdesc}{grad}{a,\optional{where}}  
 returns the gradient of the function represented by the object.  
 \Data object is in \FunctionSpace \var{on} and has rank r+1 where r is the rank of the object.  
 If \var{on} is not present, a suitbale \FunctionSpace is used.  
 \index{gradient}  
 \end{funcdesc}  
   
 \begin{funcdesc}{integrate}{a,\optional{where}}  
 returns the integral of the function represented by the object. The method returns  
 a \class{numarray.NumArray} object of the same \Shape like the object.  A  
 component of the returned object is the integral of the corresponding  
 component of the object. \index{integral}  
 \end{funcdesc}  
   
 \begin{funcdesc}{interpolate}{a,where}  
 interpolates  
 the function represented by the object  
 into the \FunctionSpace\var{where}.  
 \index{interpolation}  
 \end{funcdesc}  
   
 \begin{funcdesc}{abs}{a}  
 applies the absolute value function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the exponential  
 function. \index{function!absolute value}  
 \end{funcdesc}  
   
 \begin{funcdesc}{exp}{a}  
 applies the exponential function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the exponential  
 function. \index{function!exponential}  
 \end{funcdesc}  
   
 \begin{funcdesc}{sqrt}{a}  
 applies the square root function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the square root function.  
 An exception is  
 raised if the value is negative.  \index{function!square root}  
 \end{funcdesc}  
   
 \begin{funcdesc}{sin}{a}  
 applies the sine function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the sine function. \index{function!sine}  
 \end{funcdesc}  
   
 \begin{funcdesc}{cos}{a}  
 applies the cosine function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the cosine function. \index{function!cosine}  
 \end{funcdesc}  
   
 \begin{funcdesc}{tan}{a}  
 applies the tangent function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the tangent function. \index{function!tangent}  
 \end{funcdesc}  
   
 \begin{funcdesc}{log}{a}  
 applies the logarithmic function to the object. The  
 return \Data object has the same \Shape and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints and all  
 components the value is calculated by applying the logarithmic function. An exception is  
 raised if the value is negative.\index{function!logarithmic}  
 \end{funcdesc}  
   
 \begin{funcdesc}{maxval}{}  
 returns the maximum value over all components. The  
 return value is a \Data object of rank 0  
 and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints  
 the value is calculated as the maximum value over all components. \index{function!maximum}  
 \end{funcdesc}  
   
 \begin{funcdesc}{minval}{}  
 returns the minimum value over all components. The  
 return value is a \Data object of rank 0  
 and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints  
 the value is calculated as the minimum value over all components. \index{function!minimum}  
 \end{funcdesc}  
   
 \begin{funcdesc}{length}{}  
 returns the Euclidean length at all \DataSamplePoints. The  
 return value is a \Data object of rank 0  
 and is in the same  
 \FunctionSpace like the object. For all \DataSamplePoints  
 the value is calculated as the square root of the sum of the square over all over all components. \index{function!length}  
 \end{funcdesc}  
 \begin{funcdesc}{transpose}{axis}  
 returns the transpose of the object around \var{axis}. \var{axis} is a non-negative integer  
 which is less the rank $r$ of the object. Transpose swaps the indexes $0$ to \var{axis}  
 with the indexes \var{axis}+1 to $r$. If the \var{d} is \RankFour one has  
 \begin{python}  
 d[i,j,k,l]=d.transpose(0)[i,j,k,l]  
 d[i,j,k,l]=d.transpose(1)[j,k,l,i]  
 d[i,j,k,l]=d.transpose(2)[k,l,i,j]  
 d[i,j,k,l]=d.transpose(3)[l,i,j,k]  
 \end{python}  
 \index{function!transpose}  
 \end{funcdesc}  
   
 \begin{funcdesc}{trace}{}  
 returns sum of the components with identical indexes.  
 The  
 return value is a \Data object of rank 0  
 and is in the same  
 \FunctionSpace like the object.  
 \index{function!trace}  
 \end{funcdesc}  
 \begin{funcdesc}{saveDX}{fileName}  
 saves the object to an openDX format file of name \var{fileName}, see  
 \ulink{www.opendx.org}{\url{www.opendx.org}}.  \index{openDX}  
 \end{funcdesc}  
   
   
 \begin{funcdesc}{abs}{arg}  
 returns the absolute value of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sin}{arg}  
 returns the sine of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{cos}{arg}  
 returns the cosine of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{exp}{arg}  
 returns the value of the exponential function for \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sqrt}{arg}  
 returns the square root of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{maxval}{arg}  
 returns the maximum value over all component of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{minval}{arg}  
 returns the minumum value over all component of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{length}{arg}  
 returns the length of \var{arg} which is the  
 square root of the sum of the squares of all component of \var{arg}. \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sign}{arg}  
 return the sign of \var{arg} where \var{arg}  
 can be double, a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{transpose}{arg,\optional{axis}}  
 returns the transpose of \var{arg} around \var{axis}. \var{axis} is a non-negative integer  
 which is less the rank $r$ of the object. Transpose swaps the indexes $0$ to \var{axis}  
 with the indexes \var{axis}+1 to $r$. If \var{axis} is not present, \var{axis}=$r/2$ is assumed.  
 \var{arg}  
 may be a \Data object or an \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{transpose}{arg,\optional{axis}}  
 returns the trace the object of \var{arg}. The trace is the sum over those components  
 with identical indexed.  
 \var{arg}  
 may be a \Data object or a \numarray object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sum}{arg}  
 returns the sum over all components and all  
 \DataSamplePoints of \var{arg}, where \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{sup}{arg}  
 returns the maximum over all components and all  
 \DataSamplePoints of \var{arg}, where \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{inf}{arg}  
 returns the mimumum over all components and all  
 \DataSamplePoints of \var{arg}, where \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{L2}{arg}  
 returns the $L^2$ norm of \var{arg}. This is the square root  
 of the sum of the squared value over all components and all  
 \DataSamplePoints of \var{arg}, where \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{Lsup}{arg}  
 returns the $L^{sup}$ norm of \var{arg}. This is the maximum of the absolute values  
  over all components and all  
 \DataSamplePoints of \var{arg}, where \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{dot}{arg1,arg2}  
 returns the dot product of of \var{arg1} and \var{arg2}. This is sum  
 of the product of corresponding entries in \var{arg1} and \var{arg2} over all  
 components and and all  
 \DataSamplePoints. \var{arg1} and \var{arg2} are \Data objects of the  
 same \Shape and in the same \FunctionSpace.  
 \end{funcdesc}  
   
 \begin{funcdesc}{grad}{arg,\optional{where}}  
 returns the gradient of \var{arg} as a function in the \FunctionSpace \var{where}.  
 If \var{where} is not present a reasonable \FunctionSpace is chosen.  
 \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{integrate}{arg}  
 returns the integral of \var{arg} as a \numarray object.  
 If \var{where} is not present a reasonable \FunctionSpace is chosen.  
 \var{arg}  
 is a \Data object.  
 \end{funcdesc}  
   
 \begin{funcdesc}{interpolate}{arg,where}  
 interpolate \Data object \var{arg} into the \FunctionSpace \var{where}  
 \end{funcdesc}  
   
   
923  \section{\Operator Class}  \section{\Operator Class}
   
924  The \Operator class provides an abstract access to operators build  The \Operator class provides an abstract access to operators build
925  within the \LinearPDE class. \Operator objects are created  within the \LinearPDE class. \Operator objects are created
926  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

Legend:
Removed from v.593  
changed lines
  Added in v.599

  ViewVC Help
Powered by ViewVC 1.1.26