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.
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.
note: | In the no argument form, a new object will be returned which is an independent copy of this object. |
---|
Selectively copy values from other Data.Datapoints which correspond to positive values in mask will be copied from other
Parameters: |
---|
Convert this object into lazy representation
Save the data as a netCDF file
Parameters: | fileName (string) – |
---|
Convert the data to expanded representation if it is not expanded already.
Return type: | Domain |
---|
Return type: | FunctionSpace |
---|
Return type: | int |
---|---|
Returns: | Number of datapoints in the object |
Returns: | the number of indices required to address a component of a datapoint |
---|---|
Return type: | positive int |
Returns the shape of the datapoints in this object as a python tuple. Scalar data has the shape ()
Return type: | tuple |
---|
Return tag number for the specified datapoint
Return type: | int |
---|---|
Parameters: | dpno (int) – datapoint number |
Returns: | Value of the specified datapoint |
---|---|
Return type: | tuple |
Parameters: | dataPointNo (int) – datapoint to access |
Get a specific datapoint from a specific process
Return type: | tuple |
---|---|
Parameters: |
|
Interpolate this object’s values into a new functionspace.
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
Return type: | bool |
---|---|
Returns: | True if this Data is an instance of DataConstant |
Note : | This does not mean the data is immutable. |
Is this object an instance of DataEmpty
Return type: | bool |
---|---|
Note : | This is not the same thing as asking if the object contains datapoints. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Return type: | bool |
---|---|
Returns: | True if this Data is lazy. |
Can this instance be modified. :rtype: bool
Return type: | bool |
---|---|
Returns: | True if this Data is not lazy. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Please consider using getSupLocator() from pdetools instead.
Please consider using getInfLocator() from pdetools instead.
1D interpolation with non equally spaced points
1D interpolation of slope with non equally spaced points
Convert the data to non-lazy representation.
Disallow modifications to this data object
Note : | This method does not allow you to undo protection. |
---|
Set the value of tagged Data.
param tagKey: tag to update type tagKey: int
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 |
After this call the object will store values of the same shape as before but all components will be zero.
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.
Convert data to tagged representation if it is not already tagged or expanded
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] |
---|
Bases: exceptions.Exception
Exception which is thrown if there is no convergence of the iteration process at a time step.
But there is a chance that a smaller step could help to reach convergence.
Bases: esys.escript.linearPDEs.LinearPDE
Class to define a Lame equation problem. This problem is defined as:
-grad(mu*(grad(u[i])[j]+grad(u[j])[i]))[j] - grad(lambda*grad(u[k])[k])[j] = F_i -grad(sigma[ij])[j]
with natural boundary conditions:
n[j]*(mu*(grad(u[i])[j]+grad(u[j])[i]) + lambda*grad(u[k])[k]) = f_i +n[j]*sigma[ij]
and constraints:
u[i]=r[i] where q[i]>0
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. |
Tests two coefficients for reciprocal symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficients name0 and name1 are reciprocally symmetric. |
Return type: | bool |
Tests a coefficient for symmetry.
Parameters: |
|
---|---|
Returns: | True if coefficient name is symmetric |
Return type: | bool |
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. |
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 |
Returns an instance of a new operator.
Returns an instance of a new right hand side.
Returns an instance of a new solution.
Returns the value of the coefficient name of the general PDE.
Parameters: | name (string) – name of the coefficient requested |
---|---|
Returns: | the value of the coefficient name |
Return type: | Data |
Raises IllegalCoefficient: | |
invalid coefficient name |
Returns the operator in its current state.
Returns the right hand side in its current state.
Returns the solution in its current state.
Returns the spatial dimension of the PDE.
Returns: | the spatial dimension of the PDE domain |
---|---|
Return type: | int |
Returns the domain of the PDE.
Returns: | the domain of the PDE |
---|---|
Return type: | Domain |
Return the status indicator of the domain
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 |
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 |
Returns the FunctionSpace used to discretize the equation.
Returns: | representation space of equation |
---|---|
Return type: | FunctionSpace |
Returns the FunctionSpace used to represent the solution.
Returns: | representation space of solution |
---|---|
Return type: | FunctionSpace |
Returns the number of equations.
Returns: | the number of equations |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of equations is not specified yet |
Returns the number of unknowns.
Returns: | the number of unknowns |
---|---|
Return type: | int |
Raises UndefinedPDEError: | |
if the number of unknowns is not specified yet |
Returns the operator of the linear problem.
Returns: | the operator of the problem |
---|
Returns the current system type.
Returns the system type which needs to be used by the current set up.
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 |
Returns the right hand side of the linear problem.
Returns: | the right hand side of the problem |
---|---|
Return type: | Data |
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 |
Returns the solver options
Return type: | SolverOptions |
---|
Returns the operator and right hand side of the PDE.
Returns: | the discrete version of the PDE |
---|---|
Return type: | tuple of Operator and Data |
Return the domain status used to build the current system
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 |
Resets the system clearing the operator, right hand side and solution.
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 |
---|
Introduces new coefficients into the problem.
Use:
p.introduceCoefficients(A=PDECoef(...), B=PDECoef(...))
to introduce the coefficients A and B.
Indicates the operator has to be rebuilt next time it is used.
Indicates the right hand side has to be rebuilt next time it is used.
Indicates the PDE has to be resolved if the solution is requested.
Announces that everything has to be rebuilt.
Returns True if the operator is still valid.
Returns True if the operator is still valid.
Returns True if the solution is still valid.
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() |
Returns True if the system (including solution) is still vaild.
Checks if matrix lumping is the current solver method.
Returns: | True if the current solver method is lumping |
---|---|
Return type: | bool |
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 |
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 |
Resets all coefficients to their default values.
Makes sure that the operator is instantiated and returns it initialized with zeros.
Sets the right hand side to zero.
Resets all coefficients defining the right hand side
Sets the solution to zero.
Switches debug output on if flag is True otherwise it is switched off.
Parameters: | flag (bool) – desired debug status |
---|
Switches debug output off.
Switches debug output on.
Switches reduced order off for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 |
Switches reduced order off for solution representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set. |
Switches reduced order on for solution representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 |
Switches reduced order off for solution and equation representation
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
Switches reduced order on for solution and equation representation.
Raises RuntimeError: | |
---|---|
if order reduction is altered after a coefficient has been set |
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 |
Sets the solution assuming that makes the system valid with the tolrance defined by the solver options
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. |
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 |
Clears the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the symmetry flag. :note: The method overwrites the symmetry flag set by the solver options
Sets the system status to status if status is not present the current status of the domain is used.
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Sets new values to coefficients.
Parameters: |
|
---|---|
Raises IllegalCoefficient: | |
if an unknown coefficient keyword is used |
Prints the text message if debug mode is switched on.
Parameters: | text (string) – message to be printed |
---|
Marks the operator as valid.
Marks the right hand side as valid.
Marks the solution as valid.
Bases: esys.escript.modelframe.ParameterSet
A Model object represents a process marching over time until a finalizing condition is fulfilled. At each time step an iterative process can be performed and the time step size can be controlled. A Model has the following work flow:
doInitialization()
while not terminateInitialIteration(): doInitialStep()
doInitialPostprocessing()
while not finalize():
dt=getSafeTimeStepSize(dt)
doStepPreprocessing(dt)
while not terminateIteration(): doStep(dt)
doStepPostprocessing(dt)
doFinalization()
where doInitialization, finalize, getSafeTimeStepSize, doStepPreprocessing, terminateIteration, doStepPostprocessing, doFinalization are methods of the particular instance of a Model. The default implementations of these methods have to be overwritten by the subclass implementing a Model.
Returns a set of tuples (“<self>(<name>)”, <target model>) if the parameter <name> is linked to model <target model> but <target model> is not in the list of models. If a parameter is linked to another parameter set which is not in the hash list the parameter set is checked for its models. hash gives the call history.
Declares one or more new parameters and their initial value.
Declares a set of parameters. parameters can be a list, a dictionary or a ParameterSet.
Finalizes the time stepping.
This function may be overwritten.
Finalises the initialization iteration process. This method is not called in case of a restart.
This function may be overwritten.
Performs an iteration step in the initialization phase. This method is not called in case of a restart.
This function may be overwritten.
Initializes the time stepping scheme. This method is not called in case of a restart.
This function may be overwritten.
Executes an iteration step at a time step.
dt is the currently used time step size.
This function may be overwritten.
Finalises the time step.
dt is the currently used time step size.
This function may be overwritten.
Sets up a time step of step size dt.
This function may be overwritten.
Returns False if the time stepping is finalized.
This function may be overwritten.
Returns the object stored for attribute name.
Returns a time step size which can be safely used.
dt gives the previously used step size.
This function may be overwritten.
Returns True if self has attribute name.
Removes parameter name from the parameters.
Sets up the model.
This function may be overwritten.
Returns a description of the parameters.
Returns True if iteration at the inital phase is terminated.
Returns True if iteration on a time step is terminated.
toDom method of Model class.
If debugging is on, prints the message, otherwise does nothing.
Writes the object as an XML object into an output stream.
Bases: esys.escript.modelframe.Model
*-left(etaleft(v_{i,j}+v_{j,i}
ight) ight)_{,j}+p_{,i}=F_i*
sigma_{ij}=2eta D_{ij}-p,delta_{ij}
*D_{ij}=
rac{1}{2}left( v_{j,i} + v_{i,j } ight)*
v_{k,k} = 0
Returns a set of tuples (“<self>(<name>)”, <target model>) if the parameter <name> is linked to model <target model> but <target model> is not in the list of models. If a parameter is linked to another parameter set which is not in the hash list the parameter set is checked for its models. hash gives the call history.
Declares one or more new parameters and their initial value.
Declares a set of parameters. parameters can be a list, a dictionary or a ParameterSet.
Finalizes the time stepping.
This function may be overwritten.
Finalises the initialization iteration process. This method is not called in case of a restart.
This function may be overwritten.
Performs an iteration step in the initialization phase. This method is not called in case of a restart.
This function may be overwritten.
initialize model
performs an iteration step of the penalty method. IterationDivergenceError is raised if pressure error cannot be reduced or max_iter is reached.
step up pressure iteration
if run within a time dependend problem extrapolation of pressure from previous time steps is used to get an initial guess (that needs some work!!!!!!!)
Returns False if the time stepping is finalized.
This function may be overwritten.
Returns the object stored for attribute name.
Returns a time step size which can be safely used.
dt gives the previously used step size.
This function may be overwritten.
Returns True if self has attribute name.
Removes parameter name from the parameters.
Sets up the model.
This function may be overwritten.
Returns a description of the parameters.
returns current stress
returns stertching tensor
Returns True if iteration at the inital phase is terminated.
iteration is terminateIterationd if relative pressure change is less than rel_tol
toDom method of Model class.
If debugging is on, prints the message, otherwise does nothing.
Writes the object as an XML object into an output stream.
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 |
Returns the divergence of arg at where.
Parameters: |
|
---|---|
Returns: | divergence of arg |
Return type: | escript.Data or Symbol |
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 |
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 |
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 |