esys.modellib.temperature Package¶
Classes¶
- class esys.modellib.temperature.Data¶
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
- 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 inmask
will be copied fromother
- 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, (object)dpno) int : ¶
Return tag number for the specified datapoint
- Return type:
int
- Parameters:
dpno (int) – datapoint number
- getTupleForDataPoint((Data)arg1, (object)dataPointNo) object : ¶
- Returns:
Value of the specified datapoint
- Return type:
tuple
- Parameters:
dataPointNo (
int
) – datapoint to access
- getTupleForGlobalDataPoint((Data)arg1, (object)procNo, (object)dataPointNo) object : ¶
Get a specific datapoint from a specific process
- Return type:
tuple
- Parameters:
procNo (positive
int
) – MPI rank of the processdataPointNo (int) – datapoint to access
- 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.]
- 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, (object)Amin, (object)Astep, (Data)B, (object)Bmin, (object)Bstep[, (object)undef=1e+50[, (object)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:
- 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:
interpolateTable( (Data)arg1, (object)table, (object)Amin, (object)Astep [, (object)undef=1e+50 [, (object)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 ofDataConstant
- 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, (object)check_boundaries) Data : ¶
1D interpolation with non equally spaced points
- nonuniformSlope((Data)arg1, (object)in, (object)out, (object)check_boundaries) Data : ¶
1D interpolation of slope with non equally spaced points
- promote((Data)arg1) None ¶
- 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, (object)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
orlist
- 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, (object)dataPointNo, (object)value) None ¶
setValueOfDataPoint( (Data)arg1, (object)arg2, (object)arg3) -> None
setValueOfDataPoint( (Data)arg1, (object)arg2, (object)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
orlist
- 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[, (object)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¶
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__(*args, **kwargs)¶
- class esys.modellib.temperature.Model(parameters=[], **kwargs)¶
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¶
- 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.
- getSafeTimeStepSize(dt)¶
Returns a time step size which can be safely used.
dt
gives the previously used step size.This function may be overwritten.
- setUp()¶
Sets up the model.
This function may be overwritten.
- 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.
- class esys.modellib.temperature.TemperatureAdvection(**kwargs)¶
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
- doInitialization()¶
Initializes the time stepping scheme. This method is not called in case of a restart.
This function may be overwritten.
- doStepPostprocessing(dt)¶
perform taylor galerkin step
- getSafeTimeStepSize(dt)¶
returns new step size
Functions¶
- esys.modellib.temperature.grad(arg, where=None)¶
Returns the spatial gradient of
arg
atwhere
.If
g
is the returned object, thenif
arg
is rank 0g[s]
is the derivative ofarg
with respect to thes
-th spatial dimensionif
arg
is rank 1g[i,s]
is the derivative ofarg[i]
with respect to thes
-th spatial dimensionif
arg
is rank 2g[i,j,s]
is the derivative ofarg[i,j]
with respect to thes
-th spatial dimensionif
arg
is rank 3g[i,j,k,s]
is the derivative ofarg[i,j,k]
with respect to thes
-th spatial dimension.
- Parameters:
arg (
escript.Data
orSymbol
) – function of which the gradient is to be calculated. Its rank has to be less than 3.where (
None
orescript.FunctionSpace
) – FunctionSpace in which the gradient is calculated. If not present orNone
an appropriate default is used.
- Returns:
gradient of
arg
- Return type:
escript.Data
orSymbol
- 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
andarg1
must have the same shape.- Parameters:
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns:
the inner product of
arg0
andarg1
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 ofarg
- 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