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(name)[source]

Get constant data by name.

get_data(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(region_name=None)[source]

Get all data keys.

Parameters:
region_name : str

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

iter_terms(equations, only_new=True)[source]

Iterate terms for which the material data should be evaluated.

reduce_on_datas(reduce_fun, init=0.0)[source]

For non-special values only!

reset()[source]

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

set_all_data(datas)[source]

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

set_data(key, qps, data)[source]

Set the material data in quadrature points.

Parameters:
key : tuple

The (region_name, integral_name) data key.

qps : Struct

Information about the quadrature points.

data : dict

The material data.

set_extra_args(**extra_args)[source]

Extra arguments passed tu the material function.

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

Evaluate material parameters in physical quadrature points.

Parameters:
ts : TimeStepper instance

The time stepper.

equations : Equations 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.

problem : Problem instance, optional

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

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

Update the material parameters in quadrature points.

Parameters:
key : tuple

The (region_name, integral_name) data key.

ts : TimeStepper

The time stepper.

equations : Equations

The equations for which the update occurs.

term : Term

The term for which the update occurs.

problem : Problem, optional

The problem definition for which the update occurs.

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

Update the special constant material parameters.

Parameters:
equations : Equations

The equations for which the update occurs.

problem : Problem, optional

The problem definition for which the update occurs.

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

Update the special material parameters.

Parameters:
ts : TimeStepper

The time stepper.

equations : Equations

The equations for which the update occurs.

problem : Problem, 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()[source]

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

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

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

Parameters:
ts : TimeStepper instance

The time stepper.

equations : Equations instance

The equations using the materials.

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

The update mode, see Material.time_update().

problem : Problem instance, optional

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

verbose : bool

If False, reduce verbosity.