esys.downunder.forwardmodels.magnetotelluric2d Package

Forward models for 2D MT (TE and TM mode)

class esys.downunder.forwardmodels.magnetotelluric2d.MT2DModelTEMode(domain, omega, x, Z_XY, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, Ex_top=1, fixAtTop=False, tol=1e-08, saveMemory=False, directSolver=True)

Bases: esys.downunder.forwardmodels.magnetotelluric2d.MT2DBase

Forward Model for two dimensional MT model in the TE mode for a given frequency omega. It defines a cost function:

  • defect = 1/2 integrate( sum_s w^s * ( E_x/H_y - Z_XY^s ) ) ** 2 *

where E_x is the horizontal electric field perpendicular to the YZ-domain, horizontal magnetic field H_y=1/(i*omega*mu) * E_{x,z} with complex unit i and permeability mu. The weighting factor w^s is set to

  • w^s(X) = w_0^s *

if length(X-X^s) <= eta and zero otherwise. X^s is the location of impedance measurement Z_XY^s, w_0^s is the level of confidence (eg. 1/measurement error) and eta is level of spatial confidence.

E_x is given as solution of the PDE

  • -E_{x,ii} - i omega * mu * sigma * E_x = 0

where E_x at top and bottom is set to solution for background field. Homogeneous Neuman conditions are assumed elsewhere.

getArguments(sigma)

Returns precomputed values shared by getDefect() and getGradient().

Parameters:sigma (Data of shape (2,)) – conductivity
Returns:Ex_, Ex_,z
Return type:Data of shape (2,)
getCoordinateTransformation()

returns the coordinate transformation being used

Return type:CoordinateTransformation
getDefect(sigma, Ex, dExdz)

Returns the defect value.

Parameters:
  • sigma (Data of shape ()) – a suggestion for conductivity
  • Ex (Data of shape (2,)) – electric field
  • dExdz (Data of shape (2,)) – vertical derivative of electric field
Return type:

float

getDomain()

Returns the domain of the forward model.

Return type:Domain
getGradient(sigma, Ex, dExdz)

Returns the gradient of the defect with respect to density.

Parameters:
  • sigma (Data of shape ()) – a suggestion for conductivity
  • Ex (Data of shape (2,)) – electric field
  • dExdz (Data of shape (2,)) – vertical derivative of electric field
getWeightingFactor(x, wx0, x0, eta)

returns the weighting factor

setUpPDE()

Return the underlying PDE.

Return type:LinearPDE
class esys.downunder.forwardmodels.magnetotelluric2d.MT2DModelTMMode(domain, omega, x, Z_YX, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, tol=1e-08, saveMemory=False, directSolver=True)

Bases: esys.downunder.forwardmodels.magnetotelluric2d.MT2DBase

Forward Model for two-dimensional MT model in the TM mode for a given frequency omega. It defines a cost function:

  • defect = 1/2 integrate( sum_s w^s * ( rho*H_x/Hy - Z_YX^s ) ) ** 2 *

where H_x is the horizontal magnetic field perpendicular to the YZ-domain, horizontal magnetic field H_y=1/(i*omega*mu) * E_{x,z} with complex unit i and permeability mu. The weighting factor w^s is set to

  • w^s(X) = w_0^s *

if length(X-X^s) <= eta and zero otherwise. X^s is the location of impedance measurement Z_XY^s, w_0^s is the level of confidence (eg. 1/measurement error) and eta is level of spatial confidence.

H_x is given as solution of the PDE

  • -(rho*H_{x,i})_{,i} + i omega * mu * H_x = 0

where H_x at top and bottom is set to solution for background field. Homogeneous Neuman conditions are assumed elsewhere.

getArguments(rho)

Returns precomputed values shared by getDefect() and getGradient().

Parameters:rho (Data of shape (2,)) – resistivity
Returns:Hx, grad(Hx)
Return type:tuple of Data
getCoordinateTransformation()

returns the coordinate transformation being used

Return type:CoordinateTransformation
getDefect(rho, Hx, g_Hx)

Returns the defect value.

Parameters:
  • rho (Data of shape ()) – a suggestion for resistivity
  • Hx (Data of shape (2,)) – magnetic field
  • g_Hx (Data of shape (2,2)) – gradient of magnetic field
Return type:

float

getDomain()

Returns the domain of the forward model.

Return type:Domain
getGradient(rho, Hx, g_Hx)

Returns the gradient of the defect with respect to resistivity.

Parameters:
  • rho (Data of shape ()) – a suggestion for resistivity
  • Hx (Data of shape (2,)) – magnetic field
  • g_Hx (Data of shape (2,2)) – gradient of magnetic field
getWeightingFactor(x, wx0, x0, eta)

returns the weighting factor

setUpPDE()

Return the underlying PDE.

Return type:LinearPDE

Classes

class esys.downunder.forwardmodels.magnetotelluric2d.Data

Bases: Boost.Python.instance

Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.

__init__((object)arg1) → None

__init__( (object)arg1, (object)value [, (object)p2 [, (object)p3 [, (object)p4]]]) -> None

conjugate((Data)arg1) → Data
copy((Data)arg1, (Data)other) → None :

Make this object a copy of other

note:The two objects will act independently from now on. That is, changing other after this call will not change this object and vice versa.
copy( (Data)arg1) -> Data :
note:In the no argument form, a new object will be returned which is an independent copy of this object.
copyWithMask((Data)arg1, (Data)other, (Data)mask) → None :

Selectively copy values from other Data.Datapoints which correspond to positive values in mask will be copied from other

Parameters:
  • other (Data) – source of values
  • mask (Scalar Data) –
delay((Data)arg1) → Data :

Convert this object into lazy representation

dump((Data)arg1, (str)fileName) → None :

Save the data as a netCDF file

Parameters:fileName (string) –
expand((Data)arg1) → None :

Convert the data to expanded representation if it is not expanded already.

getDomain((Data)arg1) → Domain :
Return type:Domain
getFunctionSpace((Data)arg1) → FunctionSpace :
Return type:FunctionSpace
getNumberOfDataPoints((Data)arg1) → int :
Return type:int
Returns:Number of datapoints in the object
getRank((Data)arg1) → int :
Returns:the number of indices required to address a component of a datapoint
Return type:positive int
getShape((Data)arg1) → tuple :

Returns the shape of the datapoints in this object as a python tuple. Scalar data has the shape ()

Return type:tuple
getTagNumber((Data)arg1, (int)dpno) → int :

Return tag number for the specified datapoint

Return type:int
Parameters:dpno (int) – datapoint number
getTupleForDataPoint((Data)arg1, (int)dataPointNo) → object :
Returns:Value of the specified datapoint
Return type:tuple
Parameters:dataPointNo (int) – datapoint to access
getTupleForGlobalDataPoint((Data)arg1, (int)procNo, (int)dataPointNo) → object :

Get a specific datapoint from a specific process

Return type:

tuple

Parameters:
  • procNo (positive int) – MPI rank of the process
  • dataPointNo (int) – datapoint to access
hasNaN((Data)arg1) → bool :

Returns return true if data contains NaN.

imag((Data)arg1) → Data
internal_maxGlobalDataPoint((Data)arg1) → tuple :

Please consider using getSupLocator() from pdetools instead.

internal_minGlobalDataPoint((Data)arg1) → tuple :

Please consider using getInfLocator() from pdetools instead.

interpolate((Data)arg1, (FunctionSpace)functionspace) → Data :

Interpolate this object’s values into a new functionspace.

interpolateTable((Data)arg1, (object)table, (float)Amin, (float)Astep, (Data)B, (float)Bmin, (float)Bstep[, (float)undef=1e+50[, (bool)check_boundaries=False]]) → Data :
Creates a new Data object by interpolating using the source data (which are

looked up in table) A must be the outer dimension on the table

param table:two dimensional collection of values
param Amin:The base of locations in table
type Amin:float
param Astep:size of gap between each item in the table
type Astep:float
param undef:upper bound on interpolated values
type undef:float
param B:Scalar representing the second coordinate to be mapped into the table
type B:Data
param Bmin:The base of locations in table for 2nd dimension
type Bmin:float
param Bstep:size of gap between each item in the table for 2nd dimension
type Bstep:float
param check_boundaries:
 if true, then values outside the boundaries will be rejected. If false, then boundary values will be used.
raise RuntimeError(DataException):
 if the coordinates do not map into the table or if the interpolated value is above undef
rtype:Data

interpolateTable( (Data)arg1, (object)table, (float)Amin, (float)Astep [, (float)undef=1e+50 [, (bool)check_boundaries=False]]) -> Data

isComplex((Data)arg1) → bool :
Return type:bool
Returns:True if this Data stores complex values.
isConstant((Data)arg1) → bool :
Return type:bool
Returns:True if this Data is an instance of DataConstant
Note:This does not mean the data is immutable.
isEmpty((Data)arg1) → bool :

Is this object an instance of DataEmpty

Return type:bool
Note:This is not the same thing as asking if the object contains datapoints.
isExpanded((Data)arg1) → bool :
Return type:bool
Returns:True if this Data is expanded.
isLazy((Data)arg1) → bool :
Return type:bool
Returns:True if this Data is lazy.
isProtected((Data)arg1) → bool :

Can this instance be modified. :rtype: bool

isReady((Data)arg1) → bool :
Return type:bool
Returns:True if this Data is not lazy.
isTagged((Data)arg1) → bool :
Return type:bool
Returns:True if this Data is expanded.
nonuniformInterpolate((Data)arg1, (object)in, (object)out, (bool)check_boundaries) → Data :

1D interpolation with non equally spaced points

nonuniformSlope((Data)arg1, (object)in, (object)out, (bool)check_boundaries) → Data :

1D interpolation of slope with non equally spaced points

promote((Data)arg1) → None
real((Data)arg1) → Data
replaceNaN((Data)arg1, (object)value) → None :

Replaces NaN values with value

resolve((Data)arg1) → None :

Convert the data to non-lazy representation.

setProtection((Data)arg1) → None :

Disallow modifications to this data object

Note:This method does not allow you to undo protection.
setTaggedValue((Data)arg1, (int)tagKey, (object)value) → None :

Set the value of tagged Data.

param tagKey:tag to update
type tagKey:int
setTaggedValue( (Data)arg1, (str)name, (object)value) -> None :
param name:tag to update
type name:string
param value:value to set tagged data to
type value:object which acts like an array, tuple or list
setToZero((Data)arg1) → None :

After this call the object will store values of the same shape as before but all components will be zero.

setValueOfDataPoint((Data)arg1, (int)dataPointNo, (object)value) → None

setValueOfDataPoint( (Data)arg1, (int)arg2, (object)arg3) -> None

setValueOfDataPoint( (Data)arg1, (int)arg2, (float)arg3) -> None :

Modify the value of a single datapoint.

param dataPointNo:
 
type dataPointNo:
 int
param value:
type value:float or an object which acts like an array, tuple or list
warning:Use of this operation is discouraged. It prevents some optimisations from operating.
tag((Data)arg1) → None :

Convert data to tagged representation if it is not already tagged or expanded

toListOfTuples((Data)arg1[, (bool)scalarastuple=False]) → object :

Return the datapoints of this object in a list. Each datapoint is stored as a tuple.

Parameters:scalarastuple – if True, scalar data will be wrapped as a tuple. True => [(0), (1), (2)]; False => [0, 1, 2]
class esys.downunder.forwardmodels.magnetotelluric2d.FileWriter(fn, append=False, createLocalFiles=False)

Bases: object

Interface to write data to a file. In essence this class wrappes the standard file object to write data that are global in MPI to a file. In fact, data are writen on the processor with MPI rank 0 only. It is recommended to use FileWriter rather than open in order to write code that is running with as well as with MPI. It is safe to use open onder MPI to read data which are global under MPI. :var name: name of file :var mode: access mode (=’w’ or =’a’) :var closed: True to indicate closed file :var newlines: line seperator

__init__(fn, append=False, createLocalFiles=False)

Opens a file of name fn for writing. If running under MPI only the first processor with rank==0 will open the file and write to it. If createLocalFiles each individual processor will create a file where for any processor with rank>0 the file name is extended by its rank. This option is normally only used for debug purposes.

Parameters:
  • fn (str) – filename.
  • append (bool) – switches on the creation of local files.
  • createLocalFiles (bool) – switches on the creation of local files.
close()

Closes the file

flush()

Flush the internal I/O buffer.

write(txt)

Write string txt to file.

Parameters:txt (str) – string txt to be written to file
writelines(txts)

Write the list txt of strings to the file.

Parameters:txts (any iterable object producing strings) – sequense of strings to be written to file
Note:Note that newlines are not added. This method is equivalent to call write() for each string.
class esys.downunder.forwardmodels.magnetotelluric2d.ForwardModel

Bases: object

An abstract forward model that can be plugged into a cost function. Subclasses need to implement getDefect(), getGradient(), and possibly getArguments() and ‘getCoordinateTransformation’.

__init__()
getArguments(x)
getCoordinateTransformation()
getDefect(x, *args)
getGradient(x, *args)
class esys.downunder.forwardmodels.magnetotelluric2d.LinearPDE(domain, numEquations=None, numSolutions=None, complex=False, debug=False)

Bases: esys.escriptcore.linearPDEs.LinearProblem

This class is used to define a general linear, steady, second order PDE for an unknown function u on a given domain defined through a Domain object.

For a single PDE having a solution with a single component the linear PDE is defined in the following form:

-(grad(A[j,l]+A_reduced[j,l])*grad(u)[l]+(B[j]+B_reduced[j])u)[j]+(C[l]+C_reduced[l])*grad(u)[l]+(D+D_reduced)=-grad(X+X_reduced)[j,j]+(Y+Y_reduced)

where grad(F) denotes the spatial derivative of F. Einstein’s summation convention, ie. summation over indexes appearing twice in a term of a sum performed, is used. The coefficients A, B, C, D, X and Y have to be specified through Data objects in Function and the coefficients A_reduced, B_reduced, C_reduced, D_reduced, X_reduced and Y_reduced have to be specified through Data objects in ReducedFunction. It is also allowed to use objects that can be converted into such Data objects. A and A_reduced are rank two, B, C, X, B_reduced, C_reduced and X_reduced are rank one and D, D_reduced, Y and Y_reduced are scalar.

The following natural boundary conditions are considered:

n[j]*((A[i,j]+A_reduced[i,j])*grad(u)[l]+(B+B_reduced)[j]*u)+(d+d_reduced)*u=n[j]*(X[j]+X_reduced[j])+y

where n is the outer normal field. Notice that the coefficients A, A_reduced, B, B_reduced, X and X_reduced are defined in the PDE. The coefficients d and y are each a scalar in FunctionOnBoundary and the coefficients d_reduced and y_reduced are each a scalar in ReducedFunctionOnBoundary.

Constraints for the solution prescribe the value of the solution at certain locations in the domain. They have the form

u=r where q>0

r and q are each scalar where q is the characteristic function defining where the constraint is applied. The constraints override any other condition set by the PDE or the boundary condition.

The PDE is symmetrical if

A[i,j]=A[j,i] and B[j]=C[j] and A_reduced[i,j]=A_reduced[j,i] and B_reduced[j]=C_reduced[j]

For a system of PDEs and a solution with several components the PDE has the form

-grad((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])[j]+(C[i,k,l]+C_reduced[i,k,l])*grad(u[k])[l]+(D[i,k]+D_reduced[i,k]*u[k] =-grad(X[i,j]+X_reduced[i,j])[j]+Y[i]+Y_reduced[i]

A and A_reduced are of rank four, B, B_reduced, C and C_reduced are each of rank three, D, D_reduced, X_reduced and X are each of rank two and Y and Y_reduced are of rank one. The natural boundary conditions take the form:

n[j]*((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])+(d[i,k]+d_reduced[i,k])*u[k]=n[j]*(X[i,j]+X_reduced[i,j])+y[i]+y_reduced[i]

The coefficient d is of rank two and y is of rank one both in FunctionOnBoundary. The coefficients d_reduced is of rank two and y_reduced is of rank one both in ReducedFunctionOnBoundary.

Constraints take the form

u[i]=r[i] where q[i]>0

r and q are each rank one. Notice that at some locations not necessarily all components must have a constraint.

The system of PDEs is symmetrical if

  • A[i,j,k,l]=A[k,l,i,j]
  • A_reduced[i,j,k,l]=A_reduced[k,l,i,j]
  • B[i,j,k]=C[k,i,j]
  • B_reduced[i,j,k]=C_reduced[k,i,j]
  • D[i,k]=D[i,k]
  • D_reduced[i,k]=D_reduced[i,k]
  • d[i,k]=d[k,i]
  • d_reduced[i,k]=d_reduced[k,i]

LinearPDE also supports solution discontinuities over a contact region in the domain. To specify the conditions across the discontinuity we are using the generalised flux J which, in the case of a system of PDEs and several components of the solution, is defined as

J[i,j]=(A[i,j,k,l]+A_reduced[[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k]-X[i,j]-X_reduced[i,j]

For the case of single solution component and single PDE J is defined as

J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[j]+(B[i]+B_reduced[i])*u-X[i]-X_reduced[i]

In the context of discontinuities n denotes the normal on the discontinuity pointing from side 0 towards side 1 calculated from FunctionSpace.getNormal of FunctionOnContactZero. For a system of PDEs the contact condition takes the form

n[j]*J0[i,j]=n[j]*J1[i,j]=(y_contact[i]+y_contact_reduced[i])- (d_contact[i,k]+d_contact_reduced[i,k])*jump(u)[k]

where J0 and J1 are the fluxes on side 0 and side 1 of the discontinuity, respectively. jump(u), which is the difference of the solution at side 1 and at side 0, denotes the jump of u across discontinuity along the normal calculated by jump. The coefficient d_contact is of rank two and y_contact is of rank one both in FunctionOnContactZero or FunctionOnContactOne. The coefficient d_contact_reduced is of rank two and y_contact_reduced is of rank one both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne. In case of a single PDE and a single component solution the contact condition takes the form

n[j]*J0_{j}=n[j]*J1_{j}=(y_contact+y_contact_reduced)-(d_contact+y_contact_reduced)*jump(u)

In this case the coefficient d_contact and y_contact are each scalar both in FunctionOnContactZero or FunctionOnContactOne and the coefficient d_contact_reduced and y_contact_reduced are each scalar both in ReducedFunctionOnContactZero or ReducedFunctionOnContactOne.

Typical usage:

p = LinearPDE(dom)
p.setValue(A=kronecker(dom), D=1, Y=0.5)
u = p.getSolution()
__init__(domain, numEquations=None, numSolutions=None, complex=False, debug=False)

Initializes a new linear PDE.

Parameters:
  • domain (Domain) – domain of the PDE
  • numEquations – number of equations. If None the number of equations is extracted from the PDE coefficients.
  • numSolutions – number of solution components. If None the number of solution components is extracted from the PDE coefficients.
  • debug – if True debug information is printed
addPDEToLumpedSystem(operator, a, b, c, hrz_lumping)

adds a PDE to the lumped system, results depend on domain

Parameters:
  • mat (OperatorAdapter) –
  • rhs (Data) –
  • a (Data) –
  • b (Data) –
  • c (Data) –
  • hrz_lumping (bool) –
addPDEToRHS(righthandside, X, Y, y, y_contact, y_dirac)

adds a PDE to the right hand side, results depend on domain

Parameters:
  • mat (OperatorAdapter) –
  • righthandside (Data) –
  • X (Data) –
  • Y (Data) –
  • y (Data) –
  • y_contact (Data) –
  • y_dirac (Data) –
addPDEToSystem(operator, righthandside, A, B, C, D, X, Y, d, y, d_contact, y_contact, d_dirac, y_dirac)

adds a PDE to the system, results depend on domain

Parameters:
addToRHS(rhs, data)

adds a PDE to the right hand side, results depend on domain

Parameters:
  • mat (OperatorAdapter) –
  • righthandside (Data) –
  • data (list) –
addToSystem(op, rhs, data)

adds a PDE to the system, results depend on domain

Parameters:
  • mat (OperatorAdapter) –
  • rhs (Data) –
  • data (list) –
alteredCoefficient(name)

Announces that coefficient name has been changed.

Parameters:name (string) – name of the coefficient affected
Raises:IllegalCoefficient – if name is not a coefficient of the PDE
Note:if name is q or r, the method will not trigger a rebuild of the system as constraints are applied to the solved system.
checkReciprocalSymmetry(name0, name1, verbose=True)

Tests two coefficients for reciprocal symmetry.

Parameters:
  • name0 (str) – name of the first coefficient
  • name1 (str) – name of the second coefficient
  • verbose (bool) – if set to True or not present a report on coefficients which break the symmetry is printed
Returns:

True if coefficients name0 and name1 are reciprocally symmetric.

Return type:

bool

checkSymmetricTensor(name, verbose=True)

Tests a coefficient for symmetry.

Parameters:
  • name (str) – name of the coefficient
  • verbose (bool) – if set to True or not present a report on coefficients which break the symmetry is printed.
Returns:

True if coefficient name is symmetric

Return type:

bool

checkSymmetry(verbose=True)

Tests the PDE for symmetry.

Parameters:verbose (bool) – if set to True or not present a report on coefficients which break the symmetry is printed.
Returns:True if the PDE is symmetric
Return type:bool
Note:This is a very expensive operation. It should be used for degugging only! The symmetry flag is not altered.
createCoefficient(name)

Creates a Data object corresponding to coefficient name.

Returns:the coefficient name initialized to 0
Return type:Data
Raises:IllegalCoefficient – if name is not a coefficient of the PDE
createOperator()

Returns an instance of a new operator.

createRightHandSide()

Returns an instance of a new right hand side.

createSolution()

Returns an instance of a new solution.

getCoefficient(name)

Returns the value of the coefficient name.

Parameters:name (string) – name of the coefficient requested
Returns:the value of the coefficient
Return type:Data
Raises:IllegalCoefficient – if name is not a coefficient of the PDE
getCurrentOperator()

Returns the operator in its current state.

getCurrentRightHandSide()

Returns the right hand side in its current state.

getCurrentSolution()

Returns the solution in its current state.

getDim()

Returns the spatial dimension of the PDE.

Returns:the spatial dimension of the PDE domain
Return type:int
getDomain()

Returns the domain of the PDE.

Returns:the domain of the PDE
Return type:Domain
getDomainStatus()

Return the status indicator of the domain

getFlux(u=None)

Returns the flux J for a given u.

J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]

or

J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]

Parameters:u (Data or None) – argument in the flux. If u is not present or equals None the current solution is used.
Returns:flux
Return type:Data
getFunctionSpaceForCoefficient(name)

Returns the FunctionSpace to be used for coefficient name.

Parameters:name (string) – name of the coefficient enquired
Returns:the function space to be used for coefficient name
Return type:FunctionSpace
Raises:IllegalCoefficient – if name is not a coefficient of the PDE
getFunctionSpaceForEquation()

Returns the FunctionSpace used to discretize the equation.

Returns:representation space of equation
Return type:FunctionSpace
getFunctionSpaceForSolution()

Returns the FunctionSpace used to represent the solution.

Returns:representation space of solution
Return type:FunctionSpace
getNumEquations()

Returns the number of equations.

Returns:the number of equations
Return type:int
Raises:UndefinedPDEError – if the number of equations is not specified yet
getNumSolutions()

Returns the number of unknowns.

Returns:the number of unknowns
Return type:int
Raises:UndefinedPDEError – if the number of unknowns is not specified yet
getOperator()

Returns the operator of the linear problem.

Returns:the operator of the problem
getOperatorType()

Returns the current system type.

getRequiredOperatorType()

Returns the system type which needs to be used by the current set up.

getResidual(u=None)

Returns the residual of u or the current solution if u is not present.

Parameters:u (Data or None) – argument in the residual calculation. It must be representable in self.getFunctionSpaceForSolution(). If u is not present or equals None the current solution is used.
Returns:residual of u
Return type:Data
getRightHandSide()

Returns the right hand side of the linear problem.

Returns:the right hand side of the problem
Return type:Data
getShapeOfCoefficient(name)

Returns the shape of the coefficient name.

Parameters:name (string) – name of the coefficient enquired
Returns:the shape of the coefficient name
Return type:tuple of int
Raises:IllegalCoefficient – if name is not a coefficient of the PDE
getSolution()

Returns the solution of the PDE.

Returns:the solution
Return type:Data
getSolverOptions()

Returns the solver options

Return type:SolverOptions
getSystem()

Returns the operator and right hand side of the PDE.

Returns:the discrete version of the PDE
Return type:tuple of Operator and Data
getSystemStatus()

Return the domain status used to build the current system

hasCoefficient(name)

Returns True if name is the name of a coefficient.

Parameters:name (string) – name of the coefficient enquired
Returns:True if name is the name of a coefficient of the general PDE, False otherwise
Return type:bool
initializeSystem()

Resets the system clearing the operator, right hand side and solution.

insertConstraint(rhs_only=False)

Applies the constraints defined by q and r to the PDE.

Parameters:rhs_only (bool) – if True only the right hand side is altered by the constraint
introduceCoefficients(**coeff)

Introduces new coefficients into the problem.

Use:

p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))

to introduce the coefficients A and B.

invalidateOperator()

Indicates the operator has to be rebuilt next time it is used.

invalidateRightHandSide()

Indicates the right hand side has to be rebuilt next time it is used.

invalidateSolution()

Indicates the PDE has to be resolved if the solution is requested.

invalidateSystem()

Announces that everything has to be rebuilt.

isComplex()

Returns true if this is a complex-valued LinearProblem, false if real-valued.

Return type:bool
isOperatorValid()

Returns True if the operator is still valid.

isRightHandSideValid()

Returns True if the operator is still valid.

isSolutionValid()

Returns True if the solution is still valid.

isSymmetric()

Checks if symmetry is indicated.

Returns:True if a symmetric PDE is indicated, False otherwise
Return type:bool
Note:the method is equivalent to use getSolverOptions().isSymmetric()
isSystemValid()

Returns True if the system (including solution) is still vaild.

isUsingLumping()

Checks if matrix lumping is the current solver method.

Returns:True if the current solver method is lumping
Return type:bool
preservePreconditioner(preserve=True)

Notifies the PDE that the preconditioner should not be reset when making changes to the operator.

Building the preconditioner data can be quite expensive (e.g. for multigrid methods) so if it is known that changes to the operator are going to be minor calling this method can speed up successive PDE solves.

Note:Not all operator types support this.
Parameters:preserve (bool) – if True, preconditioner will be preserved, otherwise it will be reset when making changes to the operator, which is the default behaviour.
reduceEquationOrder()

Returns the status of order reduction for the equation.

Returns:True if reduced interpolation order is used for the representation of the equation, False otherwise
Return type:bool
reduceSolutionOrder()

Returns the status of order reduction for the solution.

Returns:True if reduced interpolation order is used for the representation of the solution, False otherwise
Return type:bool
resetAllCoefficients()

Resets all coefficients to their default values.

resetOperator()

Makes sure that the operator is instantiated and returns it initialized with zeros.

resetRightHandSide()

Sets the right hand side to zero.

resetRightHandSideCoefficients()

Resets all coefficients defining the right hand side

resetSolution()

Sets the solution to zero.

setDebug(flag)

Switches debug output on if flag is True otherwise it is switched off.

Parameters:flag (bool) – desired debug status
setDebugOff()

Switches debug output off.

setDebugOn()

Switches debug output on.

setReducedOrderForEquationOff()

Switches reduced order off for equation representation.

Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderForEquationOn()

Switches reduced order on for equation representation.

Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderForEquationTo(flag=False)

Sets order reduction state for equation representation according to flag.

Parameters:flag (bool) – if flag is True, the order reduction is switched on for equation representation, otherwise or if flag is not present order reduction is switched off
Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderForSolutionOff()

Switches reduced order off for solution representation

Raises:RuntimeError – if order reduction is altered after a coefficient has been set.
setReducedOrderForSolutionOn()

Switches reduced order on for solution representation.

Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderForSolutionTo(flag=False)

Sets order reduction state for solution representation according to flag.

Parameters:flag (bool) – if flag is True, the order reduction is switched on for solution representation, otherwise or if flag is not present order reduction is switched off
Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderOff()

Switches reduced order off for solution and equation representation

Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderOn()

Switches reduced order on for solution and equation representation.

Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setReducedOrderTo(flag=False)

Sets order reduction state for both solution and equation representation according to flag.

Parameters:flag (bool) – if True, the order reduction is switched on for both solution and equation representation, otherwise or if flag is not present order reduction is switched off
Raises:RuntimeError – if order reduction is altered after a coefficient has been set
setSolution(u, validate=True)

Sets the solution assuming that makes the system valid with the tolrance defined by the solver options

setSolverOptions(options=None)

Sets the solver options.

Parameters:options (SolverOptions or None) – the new solver options. If equal None, the solver options are set to the default.
Note:The symmetry flag of options is overwritten by the symmetry flag of the LinearProblem.
setSymmetry(flag=False)

Sets the symmetry flag to flag.

Parameters:flag (bool) – If True, the symmetry flag is set otherwise reset.
Note:The method overwrites the symmetry flag set by the solver options
setSymmetryOff()

Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options

setSymmetryOn()

Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options

setSystemStatus(status=None)

Sets the system status to status if status is not present the current status of the domain is used.

setValue(**coefficients)

Sets new values to coefficients.

Parameters:
  • coefficients – new values assigned to coefficients
  • A (any type that can be cast to a Data object on Function) – value for coefficient A
  • A_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient A_reduced
  • B (any type that can be cast to a Data object on Function) – value for coefficient B
  • B_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient B_reduced
  • C (any type that can be cast to a Data object on Function) – value for coefficient C
  • C_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient C_reduced
  • D (any type that can be cast to a Data object on Function) – value for coefficient D
  • D_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient D_reduced
  • X (any type that can be cast to a Data object on Function) – value for coefficient X
  • X_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient X_reduced
  • Y (any type that can be cast to a Data object on Function) – value for coefficient Y
  • Y_reduced (any type that can be cast to a Data object on ReducedFunction) – value for coefficient Y_reduced
  • d (any type that can be cast to a Data object on FunctionOnBoundary) – value for coefficient d
  • d_reduced (any type that can be cast to a Data object on ReducedFunctionOnBoundary) – value for coefficient d_reduced
  • y (any type that can be cast to a Data object on FunctionOnBoundary) – value for coefficient y
  • d_contact (any type that can be cast to a Data object on FunctionOnContactOne or FunctionOnContactZero) – value for coefficient d_contact
  • d_contact_reduced (any type that can be cast to a Data object on ReducedFunctionOnContactOne or ReducedFunctionOnContactZero) – value for coefficient d_contact_reduced
  • y_contact (any type that can be cast to a Data object on FunctionOnContactOne or FunctionOnContactZero) – value for coefficient y_contact
  • y_contact_reduced (any type that can be cast to a Data object on ReducedFunctionOnContactOne or ReducedFunctionOnContactZero) – value for coefficient y_contact_reduced
  • d_dirac (any type that can be cast to a Data object on DiracDeltaFunctions) – value for coefficient d_dirac
  • y_dirac (any type that can be cast to a Data object on DiracDeltaFunctions) – value for coefficient y_dirac
  • r (any type that can be cast to a Data object on Solution or ReducedSolution depending on whether reduced order is used for the solution) – values prescribed to the solution at the locations of constraints
  • q (any type that can be cast to a Data object on Solution or ReducedSolution depending on whether reduced order is used for the representation of the equation) – mask for location of constraints
Raises:

IllegalCoefficient – if an unknown coefficient keyword is used

shouldPreservePreconditioner()

Returns true if the preconditioner / factorisation should be kept even when resetting the operator.

Return type:bool
trace(text)

Prints the text message if debug mode is switched on.

Parameters:text (string) – message to be printed
validOperator()

Marks the operator as valid.

validRightHandSide()

Marks the right hand side as valid.

validSolution()

Marks the solution as valid.

class esys.downunder.forwardmodels.magnetotelluric2d.MT2DBase(domain, omega, x, Z, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, fixAirLayer=False, coordinates=None, tol=1e-08, saveMemory=False, directSolver=True)

Bases: esys.downunder.forwardmodels.base.ForwardModel

Base class for 2D MT forward models. See MT2DModelTEMode and MT2DModelTMMode for actual implementations.

__init__(domain, omega, x, Z, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, fixAirLayer=False, coordinates=None, tol=1e-08, saveMemory=False, directSolver=True)

initializes a new forward model.

Parameters:
  • domain (Domain) – domain of the model
  • omega (positive float) – frequency
  • x (list of tuple with float) – coordinates of measurements
  • Z (list of complex) – measured impedance (possibly scaled)
  • eta (positive float or list of positive float) – spatial confidence radius
  • w0 (None or a list of positive float) – confidence factors for meassurements.
  • mu (float) – permeability
  • sigma0 (float) – background conductivity
  • airLayerLevel – position of the air layer from to bottom of the domain. If not set the air layer starts at the top of the domain

:type airLayerLevel : float or None :param fixAirLayer: fix air layer (TM mode) :type fixAirLayer: bool :param coordinates: defines coordinate system to be used (not supported yet) :type coordinates: ReferenceSystem or SpatialCoordinateTransformation :param tol: tolerance of underlying PDE :type tol: positive float :param saveMemory: if true stiffness matrix is deleted after solution

of the PDE to minimize memory use. This will require more compute time as the matrix needs to be reallocated at each iteration.
Parameters:directSolver (bool) – if true a direct solver (rather than an iterative solver) will be used to solve the PDE
getArguments(x)

Returns precomputed values shared by getDefect() and getGradient(). Needs to be implemented in subclasses.

getCoordinateTransformation()

returns the coordinate transformation being used

Return type:CoordinateTransformation
getDefect(x, Ex, dExdz)

Returns the defect value. Needs to be implemented in subclasses.

getDomain()

Returns the domain of the forward model.

Return type:Domain
getGradient(x, Ex, dExdz)

Returns the gradient. Needs to be implemented in subclasses.

getWeightingFactor(x, wx0, x0, eta)

returns the weighting factor

setUpPDE()

Return the underlying PDE.

Return type:LinearPDE
class esys.downunder.forwardmodels.magnetotelluric2d.MT2DModelTEMode(domain, omega, x, Z_XY, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, Ex_top=1, fixAtTop=False, tol=1e-08, saveMemory=False, directSolver=True)

Bases: esys.downunder.forwardmodels.magnetotelluric2d.MT2DBase

Forward Model for two dimensional MT model in the TE mode for a given frequency omega. It defines a cost function:

  • defect = 1/2 integrate( sum_s w^s * ( E_x/H_y - Z_XY^s ) ) ** 2 *

where E_x is the horizontal electric field perpendicular to the YZ-domain, horizontal magnetic field H_y=1/(i*omega*mu) * E_{x,z} with complex unit i and permeability mu. The weighting factor w^s is set to

  • w^s(X) = w_0^s *

if length(X-X^s) <= eta and zero otherwise. X^s is the location of impedance measurement Z_XY^s, w_0^s is the level of confidence (eg. 1/measurement error) and eta is level of spatial confidence.

E_x is given as solution of the PDE

  • -E_{x,ii} - i omega * mu * sigma * E_x = 0

where E_x at top and bottom is set to solution for background field. Homogeneous Neuman conditions are assumed elsewhere.

__init__(domain, omega, x, Z_XY, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, Ex_top=1, fixAtTop=False, tol=1e-08, saveMemory=False, directSolver=True)

initializes a new forward model. See base class for a description of the arguments.

getArguments(sigma)

Returns precomputed values shared by getDefect() and getGradient().

Parameters:sigma (Data of shape (2,)) – conductivity
Returns:Ex_, Ex_,z
Return type:Data of shape (2,)
getCoordinateTransformation()

returns the coordinate transformation being used

Return type:CoordinateTransformation
getDefect(sigma, Ex, dExdz)

Returns the defect value.

Parameters:
  • sigma (Data of shape ()) – a suggestion for conductivity
  • Ex (Data of shape (2,)) – electric field
  • dExdz (Data of shape (2,)) – vertical derivative of electric field
Return type:

float

getDomain()

Returns the domain of the forward model.

Return type:Domain
getGradient(sigma, Ex, dExdz)

Returns the gradient of the defect with respect to density.

Parameters:
  • sigma (Data of shape ()) – a suggestion for conductivity
  • Ex (Data of shape (2,)) – electric field
  • dExdz (Data of shape (2,)) – vertical derivative of electric field
getWeightingFactor(x, wx0, x0, eta)

returns the weighting factor

setUpPDE()

Return the underlying PDE.

Return type:LinearPDE
class esys.downunder.forwardmodels.magnetotelluric2d.MT2DModelTMMode(domain, omega, x, Z_YX, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, tol=1e-08, saveMemory=False, directSolver=True)

Bases: esys.downunder.forwardmodels.magnetotelluric2d.MT2DBase

Forward Model for two-dimensional MT model in the TM mode for a given frequency omega. It defines a cost function:

  • defect = 1/2 integrate( sum_s w^s * ( rho*H_x/Hy - Z_YX^s ) ) ** 2 *

where H_x is the horizontal magnetic field perpendicular to the YZ-domain, horizontal magnetic field H_y=1/(i*omega*mu) * E_{x,z} with complex unit i and permeability mu. The weighting factor w^s is set to

  • w^s(X) = w_0^s *

if length(X-X^s) <= eta and zero otherwise. X^s is the location of impedance measurement Z_XY^s, w_0^s is the level of confidence (eg. 1/measurement error) and eta is level of spatial confidence.

H_x is given as solution of the PDE

  • -(rho*H_{x,i})_{,i} + i omega * mu * H_x = 0

where H_x at top and bottom is set to solution for background field. Homogeneous Neuman conditions are assumed elsewhere.

__init__(domain, omega, x, Z_YX, eta=None, w0=1.0, mu=1.2566370614359173e-06, sigma0=0.01, airLayerLevel=None, coordinates=None, tol=1e-08, saveMemory=False, directSolver=True)

initializes a new forward model. See base class for a description of the arguments.

getArguments(rho)

Returns precomputed values shared by getDefect() and getGradient().

Parameters:rho (Data of shape (2,)) – resistivity
Returns:Hx, grad(Hx)
Return type:tuple of Data
getCoordinateTransformation()

returns the coordinate transformation being used

Return type:CoordinateTransformation
getDefect(rho, Hx, g_Hx)

Returns the defect value.

Parameters:
  • rho (Data of shape ()) – a suggestion for resistivity
  • Hx (Data of shape (2,)) – magnetic field
  • g_Hx (Data of shape (2,2)) – gradient of magnetic field
Return type:

float

getDomain()

Returns the domain of the forward model.

Return type:Domain
getGradient(rho, Hx, g_Hx)

Returns the gradient of the defect with respect to resistivity.

Parameters:
  • rho (Data of shape ()) – a suggestion for resistivity
  • Hx (Data of shape (2,)) – magnetic field
  • g_Hx (Data of shape (2,2)) – gradient of magnetic field
getWeightingFactor(x, wx0, x0, eta)

returns the weighting factor

setUpPDE()

Return the underlying PDE.

Return type:LinearPDE
class esys.downunder.forwardmodels.magnetotelluric2d.SolverOptions

Bases: Boost.Python.enum

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

AGGREGATION_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.AGGREGATION_COARSENING
AMG = esys.escriptcore.escriptcpp.SolverOptions.AMG
AMLI = esys.escriptcore.escriptcpp.SolverOptions.AMLI
BACKWARD_EULER = esys.escriptcore.escriptcpp.SolverOptions.BACKWARD_EULER
BICGSTAB = esys.escriptcore.escriptcpp.SolverOptions.BICGSTAB
BOOMERAMG = esys.escriptcore.escriptcpp.SolverOptions.BOOMERAMG
CGLS = esys.escriptcore.escriptcpp.SolverOptions.CGLS
CGS = esys.escriptcore.escriptcpp.SolverOptions.CGS
CHOLEVSKY = esys.escriptcore.escriptcpp.SolverOptions.CHOLEVSKY
CIJP_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.CIJP_COARSENING
CIJP_FIXED_RANDOM_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.CIJP_FIXED_RANDOM_COARSENING
CLASSIC_INTERPOLATION = esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION
CLASSIC_INTERPOLATION_WITH_FF_COUPLING = esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION_WITH_FF_COUPLING
CR = esys.escriptcore.escriptcpp.SolverOptions.CR
CRANK_NICOLSON = esys.escriptcore.escriptcpp.SolverOptions.CRANK_NICOLSON
CUSP = esys.escriptcore.escriptcpp.SolverOptions.CUSP
DEFAULT = esys.escriptcore.escriptcpp.SolverOptions.DEFAULT
DEFAULT_REORDERING = esys.escriptcore.escriptcpp.SolverOptions.DEFAULT_REORDERING
DIRECT = esys.escriptcore.escriptcpp.SolverOptions.DIRECT
DIRECT_INTERPOLATION = esys.escriptcore.escriptcpp.SolverOptions.DIRECT_INTERPOLATION
DIRECT_MUMPS = esys.escriptcore.escriptcpp.SolverOptions.DIRECT_MUMPS
DIRECT_PARDISO = esys.escriptcore.escriptcpp.SolverOptions.DIRECT_PARDISO
DIRECT_SUPERLU = esys.escriptcore.escriptcpp.SolverOptions.DIRECT_SUPERLU
DIRECT_TRILINOS = esys.escriptcore.escriptcpp.SolverOptions.DIRECT_TRILINOS
FALGOUT_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.FALGOUT_COARSENING
GAUSS_SEIDEL = esys.escriptcore.escriptcpp.SolverOptions.GAUSS_SEIDEL
GMRES = esys.escriptcore.escriptcpp.SolverOptions.GMRES
HMIS_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.HMIS_COARSENING
HRZ_LUMPING = esys.escriptcore.escriptcpp.SolverOptions.HRZ_LUMPING
ILU0 = esys.escriptcore.escriptcpp.SolverOptions.ILU0
ILUT = esys.escriptcore.escriptcpp.SolverOptions.ILUT
ITERATIVE = esys.escriptcore.escriptcpp.SolverOptions.ITERATIVE
JACOBI = esys.escriptcore.escriptcpp.SolverOptions.JACOBI
LINEAR_CRANK_NICOLSON = esys.escriptcore.escriptcpp.SolverOptions.LINEAR_CRANK_NICOLSON
LSQR = esys.escriptcore.escriptcpp.SolverOptions.LSQR
LUMPING = esys.escriptcore.escriptcpp.SolverOptions.LUMPING
MINIMUM_FILL_IN = esys.escriptcore.escriptcpp.SolverOptions.MINIMUM_FILL_IN
MINRES = esys.escriptcore.escriptcpp.SolverOptions.MINRES
MKL = esys.escriptcore.escriptcpp.SolverOptions.MKL
NESTED_DISSECTION = esys.escriptcore.escriptcpp.SolverOptions.NESTED_DISSECTION
NONLINEAR_GMRES = esys.escriptcore.escriptcpp.SolverOptions.NONLINEAR_GMRES
NO_PRECONDITIONER = esys.escriptcore.escriptcpp.SolverOptions.NO_PRECONDITIONER
NO_REORDERING = esys.escriptcore.escriptcpp.SolverOptions.NO_REORDERING
PASO = esys.escriptcore.escriptcpp.SolverOptions.PASO
PCG = esys.escriptcore.escriptcpp.SolverOptions.PCG
PMIS_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.PMIS_COARSENING
PRES20 = esys.escriptcore.escriptcpp.SolverOptions.PRES20
REC_ILU = esys.escriptcore.escriptcpp.SolverOptions.REC_ILU
RILU = esys.escriptcore.escriptcpp.SolverOptions.RILU
ROWSUM_LUMPING = esys.escriptcore.escriptcpp.SolverOptions.ROWSUM_LUMPING
RUGE_STUEBEN_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.RUGE_STUEBEN_COARSENING
STANDARD_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.STANDARD_COARSENING
TARGET_CPU = esys.escriptcore.escriptcpp.SolverOptions.TARGET_CPU
TARGET_GPU = esys.escriptcore.escriptcpp.SolverOptions.TARGET_GPU
TFQMR = esys.escriptcore.escriptcpp.SolverOptions.TFQMR
TRILINOS = esys.escriptcore.escriptcpp.SolverOptions.TRILINOS
UMFPACK = esys.escriptcore.escriptcpp.SolverOptions.UMFPACK
YAIR_SHAPIRA_COARSENING = esys.escriptcore.escriptcpp.SolverOptions.YAIR_SHAPIRA_COARSENING
bit_length() → int

Number of bits necessary to represent self in binary. >>> bin(37) ‘0b100101’ >>> (37).bit_length() 6

conjugate()

Returns self, the complex conjugate of any int.

denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

name
names = {'BICGSTAB': esys.escriptcore.escriptcpp.SolverOptions.BICGSTAB, 'RILU': esys.escriptcore.escriptcpp.SolverOptions.RILU, 'DEFAULT_REORDERING': esys.escriptcore.escriptcpp.SolverOptions.DEFAULT_REORDERING, 'ILU0': esys.escriptcore.escriptcpp.SolverOptions.ILU0, 'TARGET_CPU': esys.escriptcore.escriptcpp.SolverOptions.TARGET_CPU, 'CHOLEVSKY': esys.escriptcore.escriptcpp.SolverOptions.CHOLEVSKY, 'DEFAULT': esys.escriptcore.escriptcpp.SolverOptions.DEFAULT, 'MKL': esys.escriptcore.escriptcpp.SolverOptions.MKL, 'ITERATIVE': esys.escriptcore.escriptcpp.SolverOptions.ITERATIVE, 'DIRECT': esys.escriptcore.escriptcpp.SolverOptions.DIRECT, 'BACKWARD_EULER': esys.escriptcore.escriptcpp.SolverOptions.BACKWARD_EULER, 'BOOMERAMG': esys.escriptcore.escriptcpp.SolverOptions.BOOMERAMG, 'GAUSS_SEIDEL': esys.escriptcore.escriptcpp.SolverOptions.GAUSS_SEIDEL, 'CIJP_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.CIJP_COARSENING, 'PCG': esys.escriptcore.escriptcpp.SolverOptions.PCG, 'NO_PRECONDITIONER': esys.escriptcore.escriptcpp.SolverOptions.NO_PRECONDITIONER, 'LUMPING': esys.escriptcore.escriptcpp.SolverOptions.LUMPING, 'TARGET_GPU': esys.escriptcore.escriptcpp.SolverOptions.TARGET_GPU, 'CGLS': esys.escriptcore.escriptcpp.SolverOptions.CGLS, 'CIJP_FIXED_RANDOM_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.CIJP_FIXED_RANDOM_COARSENING, 'PMIS_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.PMIS_COARSENING, 'TFQMR': esys.escriptcore.escriptcpp.SolverOptions.TFQMR, 'UMFPACK': esys.escriptcore.escriptcpp.SolverOptions.UMFPACK, 'AMG': esys.escriptcore.escriptcpp.SolverOptions.AMG, 'RUGE_STUEBEN_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.RUGE_STUEBEN_COARSENING, 'MINRES': esys.escriptcore.escriptcpp.SolverOptions.MINRES, 'CLASSIC_INTERPOLATION_WITH_FF_COUPLING': esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION_WITH_FF_COUPLING, 'NO_REORDERING': esys.escriptcore.escriptcpp.SolverOptions.NO_REORDERING, 'MINIMUM_FILL_IN': esys.escriptcore.escriptcpp.SolverOptions.MINIMUM_FILL_IN, 'CGS': esys.escriptcore.escriptcpp.SolverOptions.CGS, 'CRANK_NICOLSON': esys.escriptcore.escriptcpp.SolverOptions.CRANK_NICOLSON, 'NESTED_DISSECTION': esys.escriptcore.escriptcpp.SolverOptions.NESTED_DISSECTION, 'LSQR': esys.escriptcore.escriptcpp.SolverOptions.LSQR, 'NONLINEAR_GMRES': esys.escriptcore.escriptcpp.SolverOptions.NONLINEAR_GMRES, 'AMLI': esys.escriptcore.escriptcpp.SolverOptions.AMLI, 'ILUT': esys.escriptcore.escriptcpp.SolverOptions.ILUT, 'CUSP': esys.escriptcore.escriptcpp.SolverOptions.CUSP, 'CLASSIC_INTERPOLATION': esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION, 'HRZ_LUMPING': esys.escriptcore.escriptcpp.SolverOptions.HRZ_LUMPING, 'AGGREGATION_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.AGGREGATION_COARSENING, 'STANDARD_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.STANDARD_COARSENING, 'TRILINOS': esys.escriptcore.escriptcpp.SolverOptions.TRILINOS, 'PASO': esys.escriptcore.escriptcpp.SolverOptions.PASO, 'PRES20': esys.escriptcore.escriptcpp.SolverOptions.PRES20, 'HMIS_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.HMIS_COARSENING, 'YAIR_SHAPIRA_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.YAIR_SHAPIRA_COARSENING, 'CR': esys.escriptcore.escriptcpp.SolverOptions.CR, 'ROWSUM_LUMPING': esys.escriptcore.escriptcpp.SolverOptions.ROWSUM_LUMPING, 'DIRECT_SUPERLU': esys.escriptcore.escriptcpp.SolverOptions.DIRECT_SUPERLU, 'DIRECT_TRILINOS': esys.escriptcore.escriptcpp.SolverOptions.DIRECT_TRILINOS, 'LINEAR_CRANK_NICOLSON': esys.escriptcore.escriptcpp.SolverOptions.LINEAR_CRANK_NICOLSON, 'DIRECT_MUMPS': esys.escriptcore.escriptcpp.SolverOptions.DIRECT_MUMPS, 'DIRECT_INTERPOLATION': esys.escriptcore.escriptcpp.SolverOptions.DIRECT_INTERPOLATION, 'DIRECT_PARDISO': esys.escriptcore.escriptcpp.SolverOptions.DIRECT_PARDISO, 'FALGOUT_COARSENING': esys.escriptcore.escriptcpp.SolverOptions.FALGOUT_COARSENING, 'REC_ILU': esys.escriptcore.escriptcpp.SolverOptions.REC_ILU, 'GMRES': esys.escriptcore.escriptcpp.SolverOptions.GMRES, 'JACOBI': esys.escriptcore.escriptcpp.SolverOptions.JACOBI}
numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

values = {0: esys.escriptcore.escriptcpp.SolverOptions.DEFAULT, 1: esys.escriptcore.escriptcpp.SolverOptions.TARGET_CPU, 2: esys.escriptcore.escriptcpp.SolverOptions.TARGET_GPU, 3: esys.escriptcore.escriptcpp.SolverOptions.CUSP, 4: esys.escriptcore.escriptcpp.SolverOptions.MKL, 5: esys.escriptcore.escriptcpp.SolverOptions.PASO, 6: esys.escriptcore.escriptcpp.SolverOptions.TRILINOS, 7: esys.escriptcore.escriptcpp.SolverOptions.UMFPACK, 8: esys.escriptcore.escriptcpp.SolverOptions.BICGSTAB, 9: esys.escriptcore.escriptcpp.SolverOptions.CGLS, 10: esys.escriptcore.escriptcpp.SolverOptions.CGS, 11: esys.escriptcore.escriptcpp.SolverOptions.CHOLEVSKY, 12: esys.escriptcore.escriptcpp.SolverOptions.CR, 13: esys.escriptcore.escriptcpp.SolverOptions.DIRECT, 14: esys.escriptcore.escriptcpp.SolverOptions.DIRECT_MUMPS, 15: esys.escriptcore.escriptcpp.SolverOptions.DIRECT_PARDISO, 16: esys.escriptcore.escriptcpp.SolverOptions.DIRECT_SUPERLU, 17: esys.escriptcore.escriptcpp.SolverOptions.DIRECT_TRILINOS, 18: esys.escriptcore.escriptcpp.SolverOptions.GMRES, 19: esys.escriptcore.escriptcpp.SolverOptions.HRZ_LUMPING, 20: esys.escriptcore.escriptcpp.SolverOptions.ITERATIVE, 21: esys.escriptcore.escriptcpp.SolverOptions.LSQR, 22: esys.escriptcore.escriptcpp.SolverOptions.MINRES, 23: esys.escriptcore.escriptcpp.SolverOptions.NONLINEAR_GMRES, 24: esys.escriptcore.escriptcpp.SolverOptions.PCG, 25: esys.escriptcore.escriptcpp.SolverOptions.PRES20, 26: esys.escriptcore.escriptcpp.SolverOptions.ROWSUM_LUMPING, 27: esys.escriptcore.escriptcpp.SolverOptions.TFQMR, 28: esys.escriptcore.escriptcpp.SolverOptions.AMG, 29: esys.escriptcore.escriptcpp.SolverOptions.AMLI, 30: esys.escriptcore.escriptcpp.SolverOptions.BOOMERAMG, 31: esys.escriptcore.escriptcpp.SolverOptions.GAUSS_SEIDEL, 32: esys.escriptcore.escriptcpp.SolverOptions.ILU0, 33: esys.escriptcore.escriptcpp.SolverOptions.ILUT, 34: esys.escriptcore.escriptcpp.SolverOptions.JACOBI, 35: esys.escriptcore.escriptcpp.SolverOptions.NO_PRECONDITIONER, 36: esys.escriptcore.escriptcpp.SolverOptions.REC_ILU, 37: esys.escriptcore.escriptcpp.SolverOptions.RILU, 38: esys.escriptcore.escriptcpp.SolverOptions.BACKWARD_EULER, 39: esys.escriptcore.escriptcpp.SolverOptions.CRANK_NICOLSON, 40: esys.escriptcore.escriptcpp.SolverOptions.LINEAR_CRANK_NICOLSON, 41: esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION, 42: esys.escriptcore.escriptcpp.SolverOptions.CLASSIC_INTERPOLATION_WITH_FF_COUPLING, 43: esys.escriptcore.escriptcpp.SolverOptions.DIRECT_INTERPOLATION, 44: esys.escriptcore.escriptcpp.SolverOptions.AGGREGATION_COARSENING, 45: esys.escriptcore.escriptcpp.SolverOptions.CIJP_COARSENING, 46: esys.escriptcore.escriptcpp.SolverOptions.CIJP_FIXED_RANDOM_COARSENING, 47: esys.escriptcore.escriptcpp.SolverOptions.FALGOUT_COARSENING, 48: esys.escriptcore.escriptcpp.SolverOptions.HMIS_COARSENING, 49: esys.escriptcore.escriptcpp.SolverOptions.PMIS_COARSENING, 50: esys.escriptcore.escriptcpp.SolverOptions.RUGE_STUEBEN_COARSENING, 51: esys.escriptcore.escriptcpp.SolverOptions.STANDARD_COARSENING, 52: esys.escriptcore.escriptcpp.SolverOptions.YAIR_SHAPIRA_COARSENING, 53: esys.escriptcore.escriptcpp.SolverOptions.DEFAULT_REORDERING, 54: esys.escriptcore.escriptcpp.SolverOptions.MINIMUM_FILL_IN, 55: esys.escriptcore.escriptcpp.SolverOptions.NESTED_DISSECTION, 56: esys.escriptcore.escriptcpp.SolverOptions.NO_REORDERING}

Functions

esys.downunder.forwardmodels.magnetotelluric2d.Abs(arg)

Returns the absolute value of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.C_GeneralTensorProduct((Data)arg0, (Data)arg1[, (int)axis_offset=0[, (int)transpose=0]]) → Data :

Compute a tensor product of two Data objects.

Return type:

Data

Parameters:
  • arg0
  • arg1
  • axis_offset (int) –
  • transpose (int) – 0: transpose neither, 1: transpose arg0, 2: transpose arg1
esys.downunder.forwardmodels.magnetotelluric2d.Function((Domain)domain) → FunctionSpace :
Returns:a function FunctionSpace
Return type:FunctionSpace
esys.downunder.forwardmodels.magnetotelluric2d.FunctionOnBoundary((Domain)domain) → FunctionSpace :
Returns:a function on boundary FunctionSpace
Return type:FunctionSpace
esys.downunder.forwardmodels.magnetotelluric2d.L2(arg)

Returns the L2 norm of arg at where.

Parameters:arg (escript.Data or Symbol) – function of which the L2 norm is to be calculated
Returns:L2 norm of arg
Return type:float or Symbol
Note:L2(arg) is equivalent to sqrt(integrate(inner(arg,arg)))
esys.downunder.forwardmodels.magnetotelluric2d.Lsup(arg)

Returns the Lsup-norm of argument arg. This is the maximum absolute value over all data points. This function is equivalent to sup(abs(arg)).

Parameters:arg (float, int, escript.Data, numpy.ndarray) – argument
Returns:maximum value of the absolute value of arg over all components and all data points
Return type:float
Raises:TypeError – if type of arg cannot be processed
esys.downunder.forwardmodels.magnetotelluric2d.Scalar([(float)value=0.0[, (FunctionSpace)what=<esys.escriptcore.escriptcpp.FunctionSpace object at 0x7f24db749950>[, (bool)expanded=False]]]) → Data :

Construct a Data object containing scalar data-points.

Parameters:
  • value (float) – scalar value for all points
  • what (FunctionSpace) – FunctionSpace for Data
  • expanded (bool) – If True, a value is stored for each point. If False, more efficient representations may be used
Return type:

Data

esys.downunder.forwardmodels.magnetotelluric2d.Solution((Domain)domain) → FunctionSpace :
Return type:FunctionSpace
esys.downunder.forwardmodels.magnetotelluric2d.Vector([(float)value=0.0[, (FunctionSpace)what=<esys.escriptcore.escriptcpp.FunctionSpace object at 0x7f24db7499d0>[, (bool)expanded=False]]]) → Data :

Construct a Data object containing rank1 data-points.

param value:scalar value for all points
rtype:Data
type value:float
param what:FunctionSpace for Data
type what:FunctionSpace
param expanded:If True, a value is stored for each point. If False, more efficient representations may be used
type expanded:bool

Vector( (object)value [, (FunctionSpace)what=<esys.escriptcore.escriptcpp.FunctionSpace object at 0x7f24db749a50> [, (bool)expanded=False]]) -> Data

esys.downunder.forwardmodels.magnetotelluric2d.acos(arg)

Returns the inverse cosine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.acosh(arg)

Returns the inverse hyperbolic cosine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.antihermitian(arg)

Returns the anti-symmetric part of the square matrix arg. That is, (arg-adjoint(arg))/2.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – input matrix. Must have rank 2 or 4 and be square.
Returns:anti-hermitian part of arg
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.antisymmetric(arg)

Returns the anti-symmetric part of the square matrix arg. That is, (arg-transpose(arg))/2.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – input matrix. Must have rank 2 or 4 and be square.
Returns:anti-symmetric part of arg
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.asin(arg)

Returns the inverse sine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.asinh(arg)

Returns the inverse hyperbolic sine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.atan(arg)

Returns inverse tangent of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.atan2(arg0, arg1)

Returns inverse tangent of argument arg0 over arg1

esys.downunder.forwardmodels.magnetotelluric2d.atanh(arg)

Returns the inverse hyperbolic tangent of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.boundingBox(domain)

Returns the bounding box of a domain

Parameters:domain (escript.Domain) – a domain
Returns:bounding box of the domain
Return type:list of pairs of float
esys.downunder.forwardmodels.magnetotelluric2d.boundingBoxEdgeLengths(domain)

Returns the edge lengths of the bounding box of a domain

Parameters:domain (escript.Domain) – a domain
Return type:list of float
esys.downunder.forwardmodels.magnetotelluric2d.clip(arg, minval=None, maxval=None)

Cuts the values of arg between minval and maxval.

Parameters:
  • arg (numpy.ndarray, escript.Data, Symbol, int or float) – argument
  • minval (float or None) – lower range. If None no lower range is applied
  • maxval (float or None) – upper range. If None no upper range is applied
Returns:

an object that contains all values from arg between minval and maxval

Return type:

numpy.ndarray, escript.Data, Symbol, int or float depending on the input

Raises:

ValueError – if minval>maxval

esys.downunder.forwardmodels.magnetotelluric2d.commonDim(*args)

Identifies, if possible, the spatial dimension across a set of objects which may or may not have a spatial dimension.

Parameters:args – given objects
Returns:the spatial dimension of the objects with identifiable dimension (see pokeDim). If none of the objects has a spatial dimension None is returned.
Return type:int or None
Raises:ValueError – if the objects with identifiable dimension don’t have the same spatial dimension.
esys.downunder.forwardmodels.magnetotelluric2d.commonShape(arg0, arg1)

Returns a shape to which arg0 can be extended from the right and arg1 can be extended from the left.

Parameters:
  • arg0 – an object with a shape (see getShape)
  • arg1 – an object with a shape (see getShape)
Returns:

the shape of arg0 or arg1 such that the left part equals the shape of arg0 and the right end equals the shape of arg1

Return type:

tuple of int

Raises:

ValueError – if no shape can be found

esys.downunder.forwardmodels.magnetotelluric2d.condEval(f, tval, fval)

Wrapper to allow non-data objects to be used.

esys.downunder.forwardmodels.magnetotelluric2d.cos(arg)

Returns cosine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.cosh(arg)

Returns the hyperbolic cosine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.delay(arg)

Returns a lazy version of arg

esys.downunder.forwardmodels.magnetotelluric2d.deviatoric(arg)

Returns the deviatoric version of arg.

esys.downunder.forwardmodels.magnetotelluric2d.diameter(domain)

Returns the diameter of a domain.

Parameters:domain (escript.Domain) – a domain
Return type:float
esys.downunder.forwardmodels.magnetotelluric2d.div(arg, where=None)

Returns the divergence of arg at where.

Parameters:
  • arg (escript.Data or Symbol) – function of which the divergence is to be calculated. Its shape has to be (d,) where d is the spatial dimension.
  • where (None or escript.FunctionSpace) – FunctionSpace in which the divergence will be calculated. If not present or None an appropriate default is used.
Returns:

divergence of arg

Return type:

escript.Data or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.eigenvalues(arg)

Returns the eigenvalues of the square matrix arg.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – square matrix. Must have rank 2 and the first and second dimension must be equal. It must also be symmetric, ie. transpose(arg)==arg (this is not checked).
Returns:the eigenvalues in increasing order
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
Note:for escript.Data and Symbol objects the dimension is restricted to 3.
esys.downunder.forwardmodels.magnetotelluric2d.eigenvalues_and_eigenvectors(arg)

Returns the eigenvalues and eigenvectors of the square matrix arg.

Parameters:arg (escript.Data) – square matrix. Must have rank 2 and the first and second dimension must be equal. It must also be symmetric, ie. transpose(arg)==arg (this is not checked).
Returns:the eigenvalues and eigenvectors. The eigenvalues are ordered by increasing value. The eigenvectors are orthogonal and normalized. If V are the eigenvectors then V[:,i] is the eigenvector corresponding to the i-th eigenvalue.
Return type:tuple of escript.Data
Note:The dimension is restricted to 3.
esys.downunder.forwardmodels.magnetotelluric2d.erf(arg)

Returns the error function erf of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.escript_generalTensorProduct(arg0, arg1, axis_offset, transpose=0)

arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!

esys.downunder.forwardmodels.magnetotelluric2d.escript_generalTensorTransposedProduct(arg0, arg1, axis_offset)

arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!

esys.downunder.forwardmodels.magnetotelluric2d.escript_generalTransposedTensorProduct(arg0, arg1, axis_offset)

arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!

esys.downunder.forwardmodels.magnetotelluric2d.escript_inverse(arg)

arg is a Data object!

esys.downunder.forwardmodels.magnetotelluric2d.exp(arg)

Returns e to the power of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.generalTensorProduct(arg0, arg1, axis_offset=0)

Generalized tensor product.

out[s,t]=Sigma_r arg0[s,r]*arg1[r,t]

where
  • s runs through arg0.Shape[:arg0.ndim-axis_offset]
  • r runs through arg1.Shape[:axis_offset]
  • t runs through arg1.Shape[axis_offset:]
Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol, float, int) – first argument
  • arg1 (numpy.ndarray, escript.Data, Symbol, float, int) – second argument
Returns:

the general tensor product of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.generalTensorTransposedProduct(arg0, arg1, axis_offset=0)

Generalized tensor product of arg0 and transpose of arg1.

out[s,t]=Sigma_r arg0[s,r]*arg1[t,r]

where
  • s runs through arg0.Shape[:arg0.ndim-axis_offset]
  • r runs through arg0.Shape[arg1.ndim-axis_offset:]
  • t runs through arg1.Shape[arg1.ndim-axis_offset:]

The function call generalTensorTransposedProduct(arg0,arg1,axis_offset) is equivalent to generalTensorProduct(arg0,transpose(arg1,arg1.ndim-axis_offset),axis_offset).

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol, float, int) – first argument
  • arg1 (numpy.ndarray, escript.Data, Symbol, float, int) – second argument
Returns:

the general tensor product of arg0 and transpose(arg1) at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.generalTransposedTensorProduct(arg0, arg1, axis_offset=0)

Generalized tensor product of transposed of arg0 and arg1.

out[s,t]=Sigma_r arg0[r,s]*arg1[r,t]

where
  • s runs through arg0.Shape[axis_offset:]
  • r runs through arg0.Shape[:axis_offset]
  • t runs through arg1.Shape[axis_offset:]

The function call generalTransposedTensorProduct(arg0,arg1,axis_offset) is equivalent to generalTensorProduct(transpose(arg0,arg0.ndim-axis_offset),arg1,axis_offset).

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol, float, int) – first argument
  • arg1 (numpy.ndarray, escript.Data, Symbol, float, int) – second argument
Returns:

the general tensor product of transpose(arg0) and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.getClosestValue(arg, origin=0)

Returns the value in arg which is closest to origin.

Parameters:
  • arg (escript.Data) – function
  • origin (float or escript.Data) – reference value
Returns:

value in arg closest to origin

Return type:

numpy.ndarray

esys.downunder.forwardmodels.magnetotelluric2d.getEpsilon()
esys.downunder.forwardmodels.magnetotelluric2d.getMPIRankWorld() → int :

Return the rank of this process in the MPI World.

esys.downunder.forwardmodels.magnetotelluric2d.getMPIWorldMax((int)arg1) → int :

Each MPI process calls this function with a value for arg1. The maximum value is computed and returned.

Return type:int
esys.downunder.forwardmodels.magnetotelluric2d.getMaxFloat()
esys.downunder.forwardmodels.magnetotelluric2d.getRank(arg)

Identifies the rank of the argument.

Parameters:arg (numpy.ndarray, escript.Data, float, int, Symbol) – an object whose rank is to be returned
Returns:the rank of the argument
Return type:int
Raises:TypeError – if type of arg cannot be processed
esys.downunder.forwardmodels.magnetotelluric2d.getShape(arg)

Identifies the shape of the argument.

Parameters:arg (numpy.ndarray, escript.Data, float, int, Symbol) – an object whose shape is to be returned
Returns:the shape of the argument
Return type:tuple of int
Raises:TypeError – if type of arg cannot be processed
esys.downunder.forwardmodels.magnetotelluric2d.getTagNames(domain)

Returns a list of tag names used by the domain.

Parameters:domain (escript.Domain) – a domain object
Returns:a list of tag names used by the domain
Return type:list of str
esys.downunder.forwardmodels.magnetotelluric2d.getVersion() → int :

This method will only report accurate version numbers for clean checkouts.

esys.downunder.forwardmodels.magnetotelluric2d.gmshGeo2Msh(geoFile, mshFile, numDim, order=1, verbosity=0)

Runs gmsh to mesh input geoFile. Returns 0 on success.

esys.downunder.forwardmodels.magnetotelluric2d.grad(arg, where=None)

Returns the spatial gradient of arg at where.

If g is the returned object, then

  • if arg is rank 0 g[s] is the derivative of arg with respect to the s-th spatial dimension
  • if arg is rank 1 g[i,s] is the derivative of arg[i] with respect to the s-th spatial dimension
  • if arg is rank 2 g[i,j,s] is the derivative of arg[i,j] with respect to the s-th spatial dimension
  • if arg is rank 3 g[i,j,k,s] is the derivative of arg[i,j,k] with respect to the s-th spatial dimension.
Parameters:
  • arg (escript.Data or Symbol) – function of which the gradient is to be calculated. Its rank has to be less than 3.
  • where (None or escript.FunctionSpace) – FunctionSpace in which the gradient is calculated. If not present or None an appropriate default is used.
Returns:

gradient of arg

Return type:

escript.Data or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.grad_n(arg, n, where=None)
esys.downunder.forwardmodels.magnetotelluric2d.hermitian(arg)

Returns the hermitian part of the square matrix arg. That is, (arg+adjoint(arg))/2.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – input matrix. Must have rank 2 or 4 and be square.
Returns:hermitian part of arg
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.identity(shape=())

Returns the shape x shape identity tensor.

Parameters:shape (tuple of int) – input shape for the identity tensor
Returns:array whose shape is shape x shape where u[i,k]=1 for i=k and u[i,k]=0 otherwise for len(shape)=1. If len(shape)=2: u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise.
Return type:numpy.ndarray of rank 1, rank 2 or rank 4
Raises:ValueError – if len(shape)>2
esys.downunder.forwardmodels.magnetotelluric2d.identityTensor(d=3)

Returns the d x d identity matrix.

Parameters:d (int, escript.Domain or escript.FunctionSpace) – dimension or an object that has the getDim method defining the dimension
Returns:the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise
Return type:numpy.ndarray or escript.Data of rank 2
esys.downunder.forwardmodels.magnetotelluric2d.identityTensor4(d=3)

Returns the d x d x d x d identity tensor.

Parameters:d (int or any object with a getDim method) – dimension or an object that has the getDim method defining the dimension
Returns:the object u of rank 4 with u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise
Return type:numpy.ndarray or escript.Data of rank 4
esys.downunder.forwardmodels.magnetotelluric2d.inf(arg)

Returns the minimum value over all data points.

Parameters:arg (float, int, escript.Data, numpy.ndarray) – argument
Returns:minimum value of arg over all components and all data points
Return type:float
Raises:TypeError – if type of arg cannot be processed
esys.downunder.forwardmodels.magnetotelluric2d.inner(arg0, arg1)

Inner product of the two arguments. The inner product is defined as:

out=Sigma_s arg0[s]*arg1[s]

where s runs through arg0.Shape.

arg0 and arg1 must have the same shape.

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol, float, int) – first argument
  • arg1 (numpy.ndarray, escript.Data, Symbol, float, int) – second argument
Returns:

the inner product of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol, float depending on the input

Raises:

ValueError – if the shapes of the arguments are not identical

esys.downunder.forwardmodels.magnetotelluric2d.insertTagNames(domain, **kwargs)

Inserts tag names into the domain.

Parameters:
  • domain (escript.Domain) – a domain object
  • <tag_name> (int) – tag key assigned to <tag_name>
esys.downunder.forwardmodels.magnetotelluric2d.insertTaggedValues(target, **kwargs)

Inserts tagged values into the target using tag names.

Parameters:
  • target (escript.Data) – data to be filled by tagged values
  • <tag_name> (float or numpy.ndarray) – value to be used for <tag_name>
Returns:

target

Return type:

escript.Data

esys.downunder.forwardmodels.magnetotelluric2d.integrate(arg, where=None)

Returns the integral of the function arg over its domain. If where is present arg is interpolated to where before integration.

Parameters:
  • arg (escript.Data or Symbol) – the function which is integrated
  • where (None or escript.FunctionSpace) – FunctionSpace in which the integral is calculated. If not present or None an appropriate default is used.
Returns:

integral of arg

Return type:

float, numpy.ndarray or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.interpolate(arg, where)

Interpolates the function into the FunctionSpace where. If the argument arg has the requested function space where no interpolation is performed and arg is returned.

Parameters:
  • arg (escript.Data or Symbol) – interpolant
  • where (escript.FunctionSpace) – FunctionSpace to be interpolated to
Returns:

interpolated argument

Return type:

escript.Data or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.interpolateTable(tab, dat, start, step, undef=1e+50, check_boundaries=False)
esys.downunder.forwardmodels.magnetotelluric2d.inverse(arg)

Returns the inverse of the square matrix arg.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – square matrix. Must have rank 2 and the first and second dimension must be equal.
Returns:inverse of the argument. matrix_mult(inverse(arg),arg) will be almost equal to kronecker(arg.getShape()[0])
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
Note:for escript.Data objects the dimension is restricted to 3.
esys.downunder.forwardmodels.magnetotelluric2d.jump(arg, domain=None)

Returns the jump of arg across the continuity of the domain.

Parameters:
  • arg (escript.Data or Symbol) – argument
  • domain (None or escript.Domain) – the domain where the discontinuity is located. If domain is not present or equal to None the domain of arg is used.
Returns:

jump of arg

Return type:

escript.Data or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.kronecker(d=3)

Returns the kronecker delta-symbol.

Parameters:d (int, escript.Domain or escript.FunctionSpace) – dimension or an object that has the getDim method defining the dimension
Returns:the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise
Return type:numpy.ndarray or escript.Data of rank 2
esys.downunder.forwardmodels.magnetotelluric2d.length(arg)

Returns the length (Euclidean norm) of argument arg at each data point.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol depending on the type of arg
esys.downunder.forwardmodels.magnetotelluric2d.listEscriptParams() → list :
Returns:A list of tuples (p,v,d) where p is the name of a parameter for escript, v is its current value, and d is a description.
esys.downunder.forwardmodels.magnetotelluric2d.log(arg)

Returns the natural logarithm of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.log10(arg)

Returns base-10 logarithm of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.longestEdge(domain)

Returns the length of the longest edge of the domain

Parameters:domain (escript.Domain) – a domain
Returns:longest edge of the domain parallel to the Cartesian axis
Return type:float
esys.downunder.forwardmodels.magnetotelluric2d.makeTransformation(domain, coordinates=None)

returns a SpatialCoordinateTransformation for the given domain

Parameters:
  • domain (esys.escript.AbstractDomain) – domain in the domain of the coordinate transformation
  • coordinates (ReferenceSystem or SpatialCoordinateTransformation) – the reference system or spatial coordinate system.
Returns:

the spatial coordinate system for the given domain of the specified reference system coordinates. If coordinates is already spatial coordinate system based on the riven domain coordinates is returned. Otherwise an appropriate spatial coordinate system is created.

Return type:

SpatialCoordinateTransformation

esys.downunder.forwardmodels.magnetotelluric2d.matchShape(arg0, arg1)

Returns a representation of arg0 and arg1 which have the same shape.

Parameters:
  • arg0 (numpy.ndarray,`escript.Data`,``float``, int, Symbol) – first argument
  • arg1 (numpy.ndarray,`escript.Data`,``float``, int, Symbol) – second argument
Returns:

arg0 and arg1 where copies are returned when the shape has to be changed

Return type:

tuple

esys.downunder.forwardmodels.magnetotelluric2d.matchType(arg0=0.0, arg1=0.0)

Converts arg0 and arg1 both to the same type numpy.ndarray or escript.Data

Parameters:
  • arg0 (numpy.ndarray,`escript.Data`,``float``, int, Symbol) – first argument
  • arg1 (numpy.ndarray,`escript.Data`,``float``, int, Symbol) – second argument
Returns:

a tuple representing arg0 and arg1 with the same type or with at least one of them being a Symbol

Return type:

tuple of two numpy.ndarray or two escript.Data

Raises:

TypeError – if type of arg0 or arg1 cannot be processed

esys.downunder.forwardmodels.magnetotelluric2d.matrix_mult(arg0, arg1)

matrix-matrix or matrix-vector product of the two arguments.

out[s0]=Sigma_{r0} arg0[s0,r0]*arg1[r0]

or

out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[r0,s1]

The second dimension of arg0 and the first dimension of arg1 must match.

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of at least rank 1
Returns:

the matrix-matrix or matrix-vector product of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

Raises:

ValueError – if the shapes of the arguments are not appropriate

esys.downunder.forwardmodels.magnetotelluric2d.matrix_transposed_mult(arg0, arg1)

matrix-transposed(matrix) product of the two arguments.

out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[s1,r0]

The function call matrix_transposed_mult(arg0,arg1) is equivalent to matrix_mult(arg0,transpose(arg1)).

The last dimensions of arg0 and arg1 must match.

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of rank 1 or 2
Returns:

the product of arg0 and the transposed of arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

Raises:

ValueError – if the shapes of the arguments are not appropriate

esys.downunder.forwardmodels.magnetotelluric2d.matrixmult(arg0, arg1)

See matrix_mult.

esys.downunder.forwardmodels.magnetotelluric2d.maximum(*args)

The maximum over arguments args.

Parameters:args (numpy.ndarray, escript.Data, Symbol, int or float) – arguments
Returns:an object which in each entry gives the maximum of the corresponding values in args
Return type:numpy.ndarray, escript.Data, Symbol, int or float depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.maxval(arg)

Returns the maximum value over all components of arg at each data point.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.meanValue(arg)

return the mean value of the argument over its domain

Parameters:arg (escript.Data) – function
Returns:mean value
Return type:float or numpy.ndarray
esys.downunder.forwardmodels.magnetotelluric2d.minimum(*args)

The minimum over arguments args.

Parameters:args (numpy.ndarray, escript.Data, Symbol, int or float) – arguments
Returns:an object which gives in each entry the minimum of the corresponding values in args
Return type:numpy.ndarray, escript.Data, Symbol, int or float depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.minval(arg)

Returns the minimum value over all components of arg at each data point.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.mkDir(*pathname)

creates a directory of name pathname if the directory does not exist.

Parameters:pathname (str or sequence of strings) – valid path name
Note:The method is MPI safe.
esys.downunder.forwardmodels.magnetotelluric2d.mult(arg0, arg1)

Product of arg0 and arg1.

Parameters:
  • arg0 (Symbol, float, int, escript.Data or numpy.ndarray) – first term
  • arg1 (Symbol, float, int, escript.Data or numpy.ndarray) – second term
Returns:

the product of arg0 and arg1

Return type:

Symbol, float, int, escript.Data or numpy.ndarray

Note:

The shape of both arguments is matched according to the rules used in matchShape.

esys.downunder.forwardmodels.magnetotelluric2d.negative(arg)

returns the negative part of arg

esys.downunder.forwardmodels.magnetotelluric2d.nonsymmetric(arg)

Deprecated alias for antisymmetric

esys.downunder.forwardmodels.magnetotelluric2d.normalize(arg, zerolength=0)

Returns the normalized version of arg (=``arg/length(arg)``).

Parameters:
  • arg (escript.Data or Symbol) – function
  • zerolength (float) – relative tolerance for arg == 0
Returns:

normalized arg where arg is non-zero, and zero elsewhere

Return type:

escript.Data or Symbol

esys.downunder.forwardmodels.magnetotelluric2d.outer(arg0, arg1)

The outer product of the two arguments. The outer product is defined as:

out[t,s]=arg0[t]*arg1[s]

where
  • s runs through arg0.Shape
  • t runs through arg1.Shape
Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol, float, int) – first argument
  • arg1 (numpy.ndarray, escript.Data, Symbol, float, int) – second argument
Returns:

the outer product of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.pokeDim(arg)

Identifies the spatial dimension of the argument.

Parameters:arg (any) – an object whose spatial dimension is to be returned
Returns:the spatial dimension of the argument, if available, or None
Return type:int or None
esys.downunder.forwardmodels.magnetotelluric2d.positive(arg)

returns the positive part of arg

esys.downunder.forwardmodels.magnetotelluric2d.printParallelThreadCounts() → None
esys.downunder.forwardmodels.magnetotelluric2d.reorderComponents(arg, index)

Resorts the components of arg according to index.

esys.downunder.forwardmodels.magnetotelluric2d.resolve(arg)

Returns the value of arg resolved.

esys.downunder.forwardmodels.magnetotelluric2d.safeDiv(arg0, arg1, rtol=None)

returns arg0/arg1 but return 0 where arg1 is (almost) zero

esys.downunder.forwardmodels.magnetotelluric2d.saveDataCSV(filename, append=False, sep=', ', csep='_', **data)

Writes Data objects to a CSV file. These objects must have compatible FunctionSpaces, i.e. it must be possible to interpolate all data to one FunctionSpace. Note, that with more than one MPI rank this function will fail for some function spaces on some domains.

Parameters:
  • filename (string) – file to save data to.
  • append (bool) – If True, then open file at end rather than beginning
  • sep (string) – separator between fields
  • csep – separator for components of rank 2 and above (e.g. ‘_’ -> c0_1)

The keyword args are Data objects to save. If a scalar Data object is passed with the name mask, then only samples which correspond to positive values in mask will be output. Example:

s=Scalar(..)
v=Vector(..)
t=Tensor(..)
f=float()
saveDataCSV("f.csv", a=s, b=v, c=t, d=f)

Will result in a file

a, b0, b1, c0_0, c0_1, .., c1_1, d 1.0, 1.5, 2.7, 3.1, 3.4, .., 0.89, 0.0 0.9, 8.7, 1.9, 3.4, 7.8, .., 1.21, 0.0

The first line is a header, the remaining lines give the values.

esys.downunder.forwardmodels.magnetotelluric2d.saveESD(datasetName, dataDir='.', domain=None, timeStep=0, deltaT=1, dynamicMesh=0, timeStepFormat='%04d', **data)

Saves Data objects to files and creates an escript dataset (ESD) file for convenient processing/visualisation.

Single timestep example:

tmp = Scalar(..)
v = Vector(..)
saveESD("solution", "data", temperature=tmp, velocity=v)

Time series example:

while t < t_end:
    tmp = Scalar(..)
    v = Vector(..)
    # save every 10 timesteps
    if t % 10 == 0:
        saveESD("solution", "data", timeStep=t, deltaT=10, temperature=tmp, velocity=v)
    t = t + 1

tmp, v and the domain are saved in native format in the “data” directory and the file “solution.esd” is created that refers to tmp by the name “temperature” and to v by the name “velocity”.

Parameters:
  • datasetName (str) – name of the dataset, used to name the ESD file
  • dataDir (str) – optional directory where the data files should be saved
  • domain (escript.Domain) – domain of the Data object(s). If not specified, the domain of the given Data objects is used.
  • timeStep (int) – current timestep or sequence number - first one must be 0
  • deltaT (int) – timestep or sequence increment, see example above
  • dynamicMesh (int) – by default the mesh is assumed to be static and thus only saved once at timestep 0 to save disk space. Setting this to 1 changes the behaviour and the mesh is saved at each timestep.
  • timeStepFormat (str) – timestep format string (defaults to “%04d”)
  • <name> (Data object) – writes the assigned value to the file using <name> as identifier
Note:

The ESD concept is experimental and the file format likely to change so use this function with caution.

Note:

The data objects have to be defined on the same domain (but not necessarily on the same FunctionSpace).

Note:

When saving a time series the first timestep must be 0 and it is assumed that data from all timesteps share the domain. The dataset file is updated in each iteration.

esys.downunder.forwardmodels.magnetotelluric2d.showEscriptParams()

Displays the parameters escript recognises with an explanation and their current value.

esys.downunder.forwardmodels.magnetotelluric2d.sign(arg)

Returns the sign of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.sin(arg)

Returns sine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.sinh(arg)

Returns the hyperbolic sine of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.sqrt(arg)

Returns the square root of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.sup(arg)

Returns the maximum value over all data points.

Parameters:arg (float, int, escript.Data, numpy.ndarray) – argument
Returns:maximum value of arg over all components and all data points
Return type:float
Raises:TypeError – if type of arg cannot be processed
esys.downunder.forwardmodels.magnetotelluric2d.swap_axes(arg, axis0=0, axis1=1)

Returns the swap of arg by swapping the components axis0 and axis1.

Parameters:
  • arg (escript.Data, Symbol, numpy.ndarray) – argument
  • axis0 (int) – first axis. axis0 must be non-negative and less than the rank of arg.
  • axis1 (int) – second axis. axis1 must be non-negative and less than the rank of arg.
Returns:

arg with swapped components

Return type:

escript.Data, Symbol or numpy.ndarray depending on the type of arg

esys.downunder.forwardmodels.magnetotelluric2d.symmetric(arg)

Returns the symmetric part of the square matrix arg. That is, (arg+transpose(arg))/2.

Parameters:arg (numpy.ndarray, escript.Data, Symbol) – input matrix. Must have rank 2 or 4 and be square.
Returns:symmetric part of arg
Return type:numpy.ndarray, escript.Data, Symbol depending on the input
esys.downunder.forwardmodels.magnetotelluric2d.tan(arg)

Returns tangent of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.tanh(arg)

Returns the hyperbolic tangent of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.tensor_mult(arg0, arg1)

The tensor product of the two arguments.

For arg0 of rank 2 this is

out[s0]=Sigma_{r0} arg0[s0,r0]*arg1[r0]

or

out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[r0,s1]

and for arg0 of rank 4 this is

out[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2,s3]

or

out[s0,s1,s2]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2]

or

out[s0,s1]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1]

In the first case the second dimension of arg0 and the last dimension of arg1 must match and in the second case the two last dimensions of arg0 must match the two first dimensions of arg1.

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2 or 4
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of shape greater than 1 or 2 depending on the rank of arg0
Returns:

the tensor product of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.tensor_transposed_mult(arg0, arg1)

The tensor product of the first and the transpose of the second argument.

For arg0 of rank 2 this is

out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[s1,r0]

and for arg0 of rank 4 this is

out[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[s2,s3,r0,r1]

or

out[s0,s1,s2]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[s2,r0,r1]

In the first case the second dimension of arg0 and arg1 must match and in the second case the two last dimensions of arg0 must match the two last dimensions of arg1.

The function call tensor_transpose_mult(arg0,arg1) is equivalent to tensor_mult(arg0,transpose(arg1)).

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2 or 4
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of shape greater of 1 or 2 depending on rank of arg0
Returns:

the tensor product of the transposed of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.tensormult(arg0, arg1)

See tensor_mult.

esys.downunder.forwardmodels.magnetotelluric2d.testForZero(arg)

Tests if the argument is identical to zero.

Parameters:arg (typically numpy.ndarray, escript.Data, float, int) – the object to test for zero
Returns:True if the argument is identical to zero, False otherwise
Return type:bool
esys.downunder.forwardmodels.magnetotelluric2d.trace(arg, axis_offset=0)

Returns the trace of arg which is the sum of arg[k,k] over k.

Parameters:
  • arg (escript.Data, Symbol, numpy.ndarray) – argument
  • axis_offset (int) – axis_offset to components to sum over. axis_offset must be non-negative and less than the rank of arg +1. The dimensions of component axis_offset and axis_offset+1 must be equal.
Returns:

trace of arg. The rank of the returned object is rank of arg minus 2.

Return type:

escript.Data, Symbol or numpy.ndarray depending on the type of arg

esys.downunder.forwardmodels.magnetotelluric2d.transpose(arg, axis_offset=None)

Returns the transpose of arg by swapping the first axis_offset and the last rank-axis_offset components.

Parameters:
  • arg (escript.Data, Symbol, numpy.ndarray, float, int) – argument
  • axis_offset (int) – the first axis_offset components are swapped with the rest. axis_offset must be non-negative and less or equal to the rank of arg. If axis_offset is not present int(r/2) where r is the rank of arg is used.
Returns:

transpose of arg

Return type:

escript.Data, Symbol, numpy.ndarray, float, int depending on the type of arg

esys.downunder.forwardmodels.magnetotelluric2d.transposed_matrix_mult(arg0, arg1)

transposed(matrix)-matrix or transposed(matrix)-vector product of the two arguments.

out[s0]=Sigma_{r0} arg0[r0,s0]*arg1[r0]

or

out[s0,s1]=Sigma_{r0} arg0[r0,s0]*arg1[r0,s1]

The function call transposed_matrix_mult(arg0,arg1) is equivalent to matrix_mult(transpose(arg0),arg1).

The first dimension of arg0 and arg1 must match.

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of at least rank 1
Returns:

the product of the transpose of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

Raises:

ValueError – if the shapes of the arguments are not appropriate

esys.downunder.forwardmodels.magnetotelluric2d.transposed_tensor_mult(arg0, arg1)

The tensor product of the transpose of the first and the second argument.

For arg0 of rank 2 this is

out[s0]=Sigma_{r0} arg0[r0,s0]*arg1[r0]

or

out[s0,s1]=Sigma_{r0} arg0[r0,s0]*arg1[r0,s1]

and for arg0 of rank 4 this is

out[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1,s2,s3]

or

out[s0,s1,s2]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1,s2]

or

out[s0,s1]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1]

In the first case the first dimension of arg0 and the first dimension of arg1 must match and in the second case the two first dimensions of arg0 must match the two first dimensions of arg1.

The function call transposed_tensor_mult(arg0,arg1) is equivalent to tensor_mult(transpose(arg0),arg1).

Parameters:
  • arg0 (numpy.ndarray, escript.Data, Symbol) – first argument of rank 2 or 4
  • arg1 (numpy.ndarray, escript.Data, Symbol) – second argument of shape greater of 1 or 2 depending on the rank of arg0
Returns:

the tensor product of transpose of arg0 and arg1 at each data point

Return type:

numpy.ndarray, escript.Data, Symbol depending on the input

esys.downunder.forwardmodels.magnetotelluric2d.unitVector(i=0, d=3)

Returns a unit vector u of dimension d whose non-zero element is at index i.

Parameters:
  • i (int) – index for non-zero element
  • d (int, escript.Domain or escript.FunctionSpace) – dimension or an object that has the getDim method defining the dimension
Returns:

the object u of rank 1 with u[j]=1 for j=index and u[j]=0 otherwise

Return type:

numpy.ndarray or escript.Data of rank 1

esys.downunder.forwardmodels.magnetotelluric2d.vol(arg)

Returns the volume or area of the oject arg

Parameters:arg (escript.FunctionSpace or escript.Domain) – a geometrical object
Return type:float
esys.downunder.forwardmodels.magnetotelluric2d.whereNegative(arg)

Returns mask of negative values of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.whereNonNegative(arg)

Returns mask of non-negative values of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.whereNonPositive(arg)

Returns mask of non-positive values of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.whereNonZero(arg, tol=0.0)

Returns mask of values different from zero of argument arg.

Parameters:
  • arg (float, escript.Data, Symbol, numpy.ndarray) – argument
  • tol (float) – absolute tolerance. Values with absolute value less than tol are accepted as zero. If tol is not present rtol``*```Lsup` (arg) is used.
Return type:

float, escript.Data, Symbol, numpy.ndarray depending on the type of arg

Raises:
  • ValueError – if rtol is non-negative.
  • TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.wherePositive(arg)

Returns mask of positive values of argument arg.

Parameters:arg (float, escript.Data, Symbol, numpy.ndarray.) – argument
Return type:float, escript.Data, Symbol, numpy.ndarray depending on the type of arg
Raises:TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.whereZero(arg, tol=None, rtol=1.4901161193847656e-08)

Returns mask of zero entries of argument arg.

Parameters:
  • arg (float, escript.Data, Symbol, numpy.ndarray) – argument
  • tol (float) – absolute tolerance. Values with absolute value less than tol are accepted as zero. If tol is not present rtol``*```Lsup` (arg) is used.
  • rtol (non-negative float) – relative tolerance used to define the absolute tolerance if tol is not present.
Return type:

float, escript.Data, Symbol, numpy.ndarray depending on the type of arg

Raises:
  • ValueError – if rtol is non-negative.
  • TypeError – if the type of the argument is not expected
esys.downunder.forwardmodels.magnetotelluric2d.zeros(shape=())

Returns the shape zero tensor.

Parameters:shape (tuple of int) – input shape for the identity tensor
Returns:array of shape filled with zeros
Return type:numpy.ndarray

Others

  • DBLE_MAX
  • EPSILON
  • PI
  • __all__
  • __builtins__
  • __copyright__
  • __doc__
  • __file__
  • __license__
  • __name__
  • __package__
  • __url__
  • division
  • print_function