esys.modellib.temperature Package

Classes

class esys.modellib.temperature.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
getX((Data)arg1) → Data :

Returns the spatial coordinates of the spatial nodes. :rtype: Data

hasInf((Data)arg1) → bool :

Returns return true if data contains +-Inf. [Note that for complex values, hasNaN and hasInf are not mutually exclusive.]

hasNaN((Data)arg1) → bool :

Returns return true if data contains NaN. [Note that for complex values, hasNaN and hasInf are not mutually exclusive.]

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

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

Replaces +-Inf values with value. [Note, for complex Data, both real and imaginary components are replaced even if only one part is Inf].

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

Replaces NaN values with value. [Note, for complex Data, both real and imaginary components are replaced even if only one part is NaN].

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.modellib.temperature.IterationDivergenceError

Bases: 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.

__init__()

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class esys.modellib.temperature.Model(parameters=[], **kwargs)

Bases: esys.escriptcore.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.

__init__(parameters=[], **kwargs)

Creates a model.

Just calls the parent constructor.

UNDEF_DT = 1e+300
checkLinkTargets(models, hash)

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.

declareParameter(**parameters)

Declares one or more new parameters and their initial value.

declareParameters(parameters)

Declares a set of parameters. parameters can be a list, a dictionary or a ParameterSet.

doFinalization()

Finalizes the time stepping.

This function may be overwritten.

doInitialPostprocessing()

Finalises the initialization iteration process. This method is not called in case of a restart.

This function may be overwritten.

doInitialStep()

Performs an iteration step in the initialization phase. This method is not called in case of a restart.

This function may be overwritten.

doInitialization()

Initializes the time stepping scheme. This method is not called in case of a restart.

This function may be overwritten.

doStep(dt)

Executes an iteration step at a time step.

dt is the currently used time step size.

This function may be overwritten.

doStepPostprocessing(dt)

Finalises the time step.

dt is the currently used time step size.

This function may be overwritten.

doStepPreprocessing(dt)

Sets up a time step of step size dt.

This function may be overwritten.

finalize()

Returns False if the time stepping is finalized.

This function may be overwritten.

classmethod fromDom(esysxml, node)
getAttributeObject(name)

Returns the object stored for attribute name.

getSafeTimeStepSize(dt)

Returns a time step size which can be safely used.

dt gives the previously used step size.

This function may be overwritten.

hasAttribute(name)

Returns True if self has attribute name.

releaseParameters(name)

Removes parameter name from the parameters.

setUp()

Sets up the model.

This function may be overwritten.

showParameters()

Returns a description of the parameters.

terminateInitialIteration()

Returns True if iteration at the inital phase is terminated.

terminateIteration()

Returns True if iteration on a time step is terminated.

toDom(esysxml, node)

toDom method of Model class.

trace(msg)

If debugging is on, prints the message, otherwise does nothing.

writeXML(ostream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)

Writes the object as an XML object into an output stream.

class esys.modellib.temperature.TemperatureAdvection(**kwargs)

Bases: esys.escriptcore.modelframe.Model

The conservation of internal heat energy is given by

rho c_p ( dT/dt+v[j] * grad(T)[j])-grad(kappa grad(T)_{,i}=Q

n_i kappa T_{,i}=0

it is assummed that *

ho c_p* is constant in time.

solved by Taylor Galerkin method
__init__(**kwargs)

Creates a model.

Just calls the parent constructor.

G(T, alpha)

tangential operator for taylor galerikin

UNDEF_DT = 1e+300
checkLinkTargets(models, hash)

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.

declareParameter(**parameters)

Declares one or more new parameters and their initial value.

declareParameters(parameters)

Declares a set of parameters. parameters can be a list, a dictionary or a ParameterSet.

doFinalization()

Finalizes the time stepping.

This function may be overwritten.

doInitialPostprocessing()

Finalises the initialization iteration process. This method is not called in case of a restart.

This function may be overwritten.

doInitialStep()

Performs an iteration step in the initialization phase. This method is not called in case of a restart.

This function may be overwritten.

doInitialization()

Initializes the time stepping scheme. This method is not called in case of a restart.

This function may be overwritten.

doStep(dt)

Executes an iteration step at a time step.

dt is the currently used time step size.

This function may be overwritten.

doStepPostprocessing(dt)

perform taylor galerkin step

doStepPreprocessing(dt)

Sets up a time step of step size dt.

This function may be overwritten.

finalize()

Returns False if the time stepping is finalized.

This function may be overwritten.

classmethod fromDom(esysxml, node)
getAttributeObject(name)

Returns the object stored for attribute name.

getSafeTimeStepSize(dt)

returns new step size

hasAttribute(name)

Returns True if self has attribute name.

releaseParameters(name)

Removes parameter name from the parameters.

setUp()

Sets up the model.

This function may be overwritten.

showParameters()

Returns a description of the parameters.

terminateInitialIteration()

Returns True if iteration at the inital phase is terminated.

terminateIteration()

Returns True if iteration on a time step is terminated.

toDom(esysxml, node)

toDom method of Model class.

trace(msg)

If debugging is on, prints the message, otherwise does nothing.

writeXML(ostream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)

Writes the object as an XML object into an output stream.

Functions

esys.modellib.temperature.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.modellib.temperature.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.modellib.temperature.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.modellib.temperature.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.modellib.temperature.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

Others

Packages