Bases: object
Tuple supporting inplace update x+=y and scaling x=a*y where x,y is an ArithmeticTuple and a is a float.
Example of usage:
from esys.escript import Data
from numpy import array
a=eData(...)
b=array([1.,4.])
x=ArithmeticTuple(a,b)
y=5.*x
Bases: esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if no convergence has been achieved in the solution correction scheme.
Bases: object
Defines a non-linear defect F(x) of a variable x.
Returns the inner product of x0 and x1
Parameters: |
|
---|---|
Returns: | the inner product of x0 and x1 |
Return type: | float |
Returns the directional derivative at x0 in the direction of v.
Parameters: |
|
---|---|
Returns: | derivative of this defect at x0 in the direction of v |
Note : | by default numerical evaluation (self.eval(x0+eps*v)-F0)/eps is used but this method maybe overwritten to use exact evaluation. |
Returns the value F of a given x.
Parameters: | x – value for which the defect F is evaluated |
---|---|
Returns: | value of the defect at x |
Returns the relative increment length used to approximate the derivative of the defect. :return: value of the defect at x :rtype: positive float
Returns the norm of argument x.
Parameters: | x – a value |
---|---|
Returns: | norm of argument x |
Return type: | float |
Note : | by default sqrt(self.bilinearform(x,x) is returned. |
Sets the relative length of the increment used to approximate the derivative of the defect. The increment is inc*norm(x)/norm(v)*v in the direction of v with x as a starting point.
Parameters: | inc (positive float) – relative increment length |
---|
Bases: object
This class provides a framework for solving linear homogeneous saddle point problems of the form:
*Av+B^*p=f*
*Bv =0*
for the unknowns v and p and given operators A and B and given right hand side f. B^* is the adjoint operator of B. A may depend weakly on v and p.
Returns Bv with accuracy tol (overwrite)
Return type: | equal to the type of p |
---|---|
Note : | boundary conditions on p should be zero! |
Returns the absolute tolerance.
Returns: | absolute tolerance |
---|---|
Return type: | float |
return a correction to the value for a given v and a given p with accuracy tol (overwrite)
Parameters: |
|
---|---|
Returns: | dv given as dv= A^{-1} (f-A v-B^*p) |
Note : | Only A may depend on v and p |
Returns the relative tolerance.
Returns: | relative tolerance |
---|---|
Return type: | float |
Returns inner product of p0 and p1 (overwrite).
Parameters: |
|
---|---|
Returns: | inner product of p0 and p1 |
Return type: | float |
Returns inner product of element p and Bv (overwrite).
Parameters: |
|
---|---|
Returns: | inner product of element p and Bv |
Return type: | float |
Note : | used if PCG is applied. |
Returns the norm of Bv (overwrite).
Return type: | equal to the type of p |
---|---|
Note : | boundary conditions on p should be zero! |
calculates the norm of p
Parameters: | p – a pressure |
---|---|
Returns: | the norm of p using the inner product for pressure |
Return type: | float |
Returns the norm of v (overwrite).
Parameters: | v – a velovity |
---|---|
Returns: | norm of v |
Return type: | non-negative float |
sets a control parameter
Parameters: |
|
---|
Sets the absolute tolerance.
Parameters: | tolerance (non-negative float) – tolerance to be used |
---|
sets a control parameter
Parameters: |
|
---|
Sets the relative tolerance for (v,p).
Parameters: | tolerance (non-negative float) – tolerance to be used |
---|
Solves the saddle point problem using initial guesses v and p.
Parameters: |
|
---|---|
Return type: | tuple of Data objects |
Note : | typically this method is overwritten by a subclass. It provides a wrapper for the _solve method. |
Solves A dv=B^*dp with accuracy tol
Parameters: | dp – a pressure increment |
---|---|
Returns: | the solution of A dv=B^*dp |
Note : | boundary conditions on dv should be zero! A is the operator used in getDV and must not be altered. |
Provides a preconditioner for (BA^{-1}B^ * ) applied to Bv with accuracy tol
Return type: | equal to the type of p |
---|---|
Note : | boundary conditions on p should be zero! |
Bases: esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if the preconditioner is not positive definite.
Bases: esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if the iteration scheme encountered an incurable breakdown.
Bases: object
Locator provides access to the values of data objects at a given spatial coordinate x.
In fact, a Locator object finds the sample in the set of samples of a given function space or domain which is closest to the given point x.
Returns the function space of the Locator.
Returns the identifier of the location.
Returns the value of data at the Locator if data is a Data object otherwise the object is returned.
Returns the exact coordinates of the Locator.
Sets the value of the data at the Locator.
Bases: esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if the maximum number of iteration steps is reached.
Bases: esys.escriptcore.pdetools.SolverSchemeException
Exception thrown if a norm calculation returns a negative norm.
Bases: object
Solves the following problem for u:
kronecker[i,j]*D[j]*u[j]=Y[i]
with constraint
u[j]=r[j] where q[j]>0
where D, Y, r and q are given functions of rank 1.
In the case of scalars this takes the form
D*u=Y
with constraint
u=r where q>0
where D, Y, r and q are given scalar functions.
The constraint overwrites any other condition.
Note : | This class is similar to the linearPDEs.LinearPDE class with A=B=C=X=0 but has the intention that all input parameters are given in Solution or ReducedSolution. |
---|
Returns the solution.
Returns: | the solution of the problem |
---|---|
Return type: | Data object in the FunctionSpace Solution or ReducedSolution |
Sets the FunctionSpace of the solution to Solution.
Sets the FunctionSpace of the solution to ReducedSolution.
Assigns values to the parameters.
Parameters: |
|
---|
Bases: object
The Projector is a factory which projects a discontinuous function onto a continuous function on a given domain.
Returns the solver options of the PDE solver.
Return type: | linearPDEs.SolverOptions |
---|
Projects input_data onto a continuous function.
Parameters: | input_data – the data to be projected |
---|
Bases: exceptions.Exception
This is a generic exception thrown by solvers.
Bases: object
A simple mechanism to manage time dependend values.
Typical usage is:
dt=0.1 # time increment
tm=TimeIntegrationManager(inital_value,p=1)
while t<1.
v_guess=tm.extrapolate(dt) # extrapolate to t+dt
v=...
tm.checkin(dt,v)
t+=dt
Note : | currently only p=1 is supported. |
---|
Adds new values to the manager. The p+1 last values are lost.
Extrapolates to dt forward in time.
Solver for
Ax=b
with a general operator A (more details required!). It uses the generalized minimum residual method (GMRES).
The iteration is terminated if
|r| <= atol+rtol*|r0|
where r0 is the initial residual and |.| is the energy norm. In fact
|r| = sqrt( bilinearform(r,r))
Parameters: |
|
---|---|
Returns: | the solution approximation and the corresponding residual |
Return type: | tuple |
Warning : | r and x are altered. |
Solver for
Ax=b
with a symmetric and positive definite operator A (more details required!). It uses the minimum residual method (MINRES) with preconditioner M providing an approximation of A.
The iteration is terminated if
|r| <= atol+rtol*|r0|
where r0 is the initial residual and |.| is the energy norm. In fact
|r| = sqrt( bilinearform(Msolve(r),r))
For details on the preconditioned conjugate gradient method see the book:
I{Templates for the Solution of Linear Systems by R. Barrett, M. Berry, T.F. Chan, J. Demmel, J. Donato, J. Dongarra, V. Eijkhout, R. Pozo, C. Romine, and H. van der Vorst}.
Parameters: |
|
---|---|
Returns: | the solution approximation and the corresponding residual |
Return type: | tuple |
Warning : | r and x are altered. |
Creates a mask on the Solution(domain) function space where the value is one for samples that touch the boundary tagged by tags.
Usage: m=MaskFromBoundaryTag(domain, “left”, “right”)
Parameters: |
|
---|---|
Returns: | a mask which marks samples that are touching the boundary tagged by any of the given tags |
Return type: | escript.Data of rank 0 |
Creates a mask on the Solution(domain) function space where the value is one for samples that touch regions tagged by tags.
Usage: m=MaskFromTag(domain, “ham”)
Parameters: |
|
---|---|
Returns: | a mask which marks samples that are touching the boundary tagged by any of the given tags |
Return type: | escript.Data of rank 0 |
Solves a non-linear problem F(x)=0 for unknown x using the stopping criterion:
norm(F(x) <= atol + rtol * norm(F(x0)
where x0 is the initial guess.
Parameters: |
|
---|---|
Returns: | an approximation of the solution with the desired accuracy |
Return type: | same type as the initial guess |
Solver for
Ax=b
with a symmetric and positive definite operator A (more details required!). It uses the conjugate gradient method with preconditioner M providing an approximation of A.
The iteration is terminated if
|r| <= atol+rtol*|r0|
where r0 is the initial residual and |.| is the energy norm. In fact
|r| = sqrt( bilinearform(Msolve(r),r))
For details on the preconditioned conjugate gradient method see the book:
I{Templates for the Solution of Linear Systems by R. Barrett, M. Berry, T.F. Chan, J. Demmel, J. Donato, J. Dongarra, V. Eijkhout, R. Pozo, C. Romine, and H. van der Vorst}.
Parameters: |
|
---|---|
Returns: | the solution approximation and the corresponding residual |
Return type: | tuple |
Warning : | r and x are altered. |
Solver for
Ax=b
with a general operator A (more details required!). It uses the Transpose-Free Quasi-Minimal Residual method (TFQMR).
The iteration is terminated if
|r| <= atol+rtol*|r0|
where r0 is the initial residual and |.| is the energy norm. In fact
|r| = sqrt( bilinearform(r,r))
Parameters: |
|
---|---|
Return type: | tuple |
Warning : | r and x are altered. |
Applies a sequence of Givens rotations (c,s) recursively to the vector vin
Warning : | vin is altered. |
---|
Return a Locator for a point with the inf value over all arg.
Return a Locator for a point with the sup value over all arg.