esys.modellib.materials Package¶
Classes¶
- GravityForce
- MaterialTable
- Model
- ParameterSet
- SimpleEarthModel
- SimpleFluidMaterial
- SimpleSolidMaterial
- 
class esys.modellib.materials.GravityForce(**kwargs)¶
- Bases: - esys.escriptcore.modelframe.ParameterSet- Sets a gravity force of given direction in given domain: - Note: - Instance variable domain - domain of interest (in). - Note: - Instance variable domain - - esys.escript.Domain- Note: - Instance variable density - density, default 1 (in). - Note: - Instance variable gravity - the gravity constant, default 9.81 (in). - Note: - Instance variable direction - the direction of gravity, default [1.,0.,0.] (in). - 
__init__(**kwargs)¶
- initializes the set 
 - 
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. 
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
gravity_force()¶
- return the gravity force as - density*- gravity*- direction
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod 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.materials.MaterialTable(**kwargs)¶
- Bases: - esys.escriptcore.modelframe.ParameterSet- A simple matrial table which allows setting physical ivar of a model - Variables: - 
__init__(**kwargs)¶
- Creates a ParameterSet with given parameters. 
 - 
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. 
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod 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.materials.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,- doFinalizationare 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. - dtis 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. - dtgives 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)¶
- toDommethod 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.materials.ParameterSet(parameters=[], **kwargs)¶
- Bases: - esys.escriptcore.modelframe.LinkableObject- A class which allows to emphasize attributes to be written and read to XML. - Leaves of an ESySParameters object can be: - a real number
- an integer number
- a string
- a boolean value
- a ParameterSet object
- a Simulation object
- a Model object
- a numpy object
- a list of booleans
- any other object (not considered by writeESySXML and writeXML)
 - Example for how to create an ESySParameters object: - p11=ParameterSet(gamma1=1.,gamma2=2.,gamma3=3.) p1=ParameterSet(dim=2,tol_v=0.001,output_file="/tmp/u.%3.3d.dx",runFlag=True,parm11=p11) parm=ParameterSet(parm1=p1,parm2=ParameterSet(alpha=Link(p11,"gamma1"))) - This can be accessed as: - parm.parm1.gamma=0. parm.parm1.dim=2 parm.parm1.tol_v=0.001 parm.parm1.output_file="/tmp/u.%3.3d.dx" parm.parm1.runFlag=True parm.parm1.parm11.gamma1=1. parm.parm1.parm11.gamma2=2. parm.parm1.parm11.gamma3=3. parm.parm2.alpha=1. (value of parm.parm1.parm11.gamma1) - 
__init__(parameters=[], **kwargs)¶
- Creates a ParameterSet with given parameters. 
 - 
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. 
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod 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.materials.SimpleEarthModel(**kwargs)¶
- Bases: - esys.escriptcore.modelframe.ParameterSet- A simple matrial table run convection models: - density=density0*(1-expansion_coefficient*(temperature-reference_temperature)) viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature)) - Variables: - gravity – gravity constants (9.81) (in)
- reference_temperature – reference temperature (in)
- density0 – density at reference temperature (in)
- viscosity0 – viscosity0 at reference temperature (in)
- alpha – viscosity contrast (in)
- expansion_coefficient – Raleigh number (in)
- heat_capacity – heat capacity (in)
- thermal_permabilty – permabilty (in)
- temperature – temperature (in)
- viscosity – viscosity (out)
- density – density (out)
 - 
__init__(**kwargs)¶
- Creates a ParameterSet with given parameters. 
 - 
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. 
 - 
density()¶
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod of Model class.
 - 
trace(msg)¶
- If debugging is on, prints the message, otherwise does nothing. 
 - 
viscosity()¶
 - 
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.materials.SimpleFluidMaterial(**kwargs)¶
- Bases: - esys.modellib.materials.MaterialTable- A simple matrial table which allows setting physical ivar of a model. - 
__init__(**kwargs)¶
- Creates a ParameterSet with given parameters. 
 - 
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. 
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod 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.materials.SimpleSolidMaterial(**kwargs)¶
- Bases: - esys.modellib.materials.MaterialTable- A simple matrial table which allows setting physical parameters of a model. - 
__init__(**kwargs)¶
- Creates a ParameterSet with given parameters. 
 - 
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. 
 - 
classmethod fromDom(esysxml, node)¶
 - 
getAttributeObject(name)¶
- Returns the object stored for attribute - name.
 - 
hasAttribute(name)¶
- Returns True if self has attribute - name.
 - 
releaseParameters(name)¶
- Removes parameter name from the parameters. 
 - 
showParameters()¶
- Returns a description of the parameters. 
 - 
toDom(esysxml, node)¶
- toDommethod 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.materials.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.ndarraydepending on the type of arg- Raises: - TypeError – if the type of the argument is not expected