sfepy.discrete.materials module

class sfepy.discrete.materials.Material(name, kind='time-dependent', function=None, values=None, flags=None, **kwargs)[source]

A class holding constitutive and other material parameters.

Example input:

material_2 = {
   'name' : 'm',
   'values' : {'E' : 1.0},
}

Material parameters are passed to terms using the dot notation, i.e. ‘m.E’ in our example case.

static from_conf(conf, functions)[source]

Construct Material instance from configuration.

get_constant_data(self, name)[source]

Get constant data by name.

get_data(self, key, name)[source]

name can be a dict - then a Struct instance with data as attributes named as the dict keys is returned.

get_keys(self, region_name=None)[source]

Get all data keys.

Parameters
region_namestr

If not None, only keys with this region are returned.

iter_terms(self, equations, only_new=True)[source]

Iterate terms for which the material data should be evaluated.

reduce_on_datas(self, reduce_fun, init=0.0)[source]

For non-special values only!

reset(self)[source]

Clear all data created by a call to time_update(), set self.mode to None.

set_all_data(self, datas)[source]

Use the provided data, set mode to ‘user’.

set_data(self, key, qps, data)[source]

Set the material data in quadrature points.

Parameters
keytuple

The (region_name, integral_name) data key.

qpsStruct

Information about the quadrature points.

datadict

The material data.

set_extra_args(self, **extra_args)[source]

Extra arguments passed tu the material function.

set_function(self, function)[source]
time_update(self, ts, equations, mode='normal', problem=None)[source]

Evaluate material parameters in physical quadrature points.

Parameters
tsTimeStepper instance

The time stepper.

equationsEquations instance

The equations using the materials.

mode‘normal’, ‘update’ or ‘force’

The update mode. In ‘force’ mode, self.datas is cleared and all updates are redone. In ‘update’ mode, existing data are preserved and new can be added. The ‘normal’ mode depends on other attributes: for stationary (self.kind == 'stationary') materials and materials in ‘user’ mode, nothing is done if self.datas is not empty. For time-dependent materials (self.kind == 'time-dependent', the default) that are not constant, i.e., are given by a user function, ‘normal’ mode behaves like ‘force’ mode. For constant materials it behaves like ‘update’ mode - existing data are reused.

problemProblem instance, optional

The problem that can be passed to user functions as a context.

update_data(self, key, ts, equations, term, problem=None)[source]

Update the material parameters in quadrature points.

Parameters
keytuple

The (region_name, integral_name) data key.

tsTimeStepper

The time stepper.

equationsEquations

The equations for which the update occurs.

termTerm

The term for which the update occurs.

problemProblem, optional

The problem definition for which the update occurs.

update_special_constant_data(self, equations=None, problem=None)[source]

Update the special constant material parameters.

Parameters
equationsEquations

The equations for which the update occurs.

problemProblem, optional

The problem definition for which the update occurs.

update_special_data(self, ts, equations, problem=None)[source]

Update the special material parameters.

Parameters
tsTimeStepper

The time stepper.

equationsEquations

The equations for which the update occurs.

problemProblem, optional

The problem definition for which the update occurs.

class sfepy.discrete.materials.Materials(objs=None, **kwargs)[source]
static from_conf(conf, functions, wanted=None)[source]

Construct Materials instance from configuration.

reset(self)[source]

Clear material data so that next materials.time_update() is performed even for stationary materials.

time_update(self, ts, equations, mode='normal', problem=None, verbose=True)[source]

Update material parameters for given time, problem, and equations.

Parameters
tsTimeStepper instance

The time stepper.

equationsEquations instance

The equations using the materials.

mode‘normal’, ‘update’ or ‘force’

The update mode, see Material.time_update().

problemProblem instance, optional

The problem that can be passed to user functions as a context.

verbosebool

If False, reduce verbosity.