SfePy NTC

Previous topic

sfepy.discrete.common.domain module

Next topic

sfepy.discrete.common.mappings module

This Page

sfepy.discrete.common.fields module

class sfepy.discrete.common.fields.Field(**kwargs)[source]

Base class for fields.

clear_mappings(clear_all=False)[source]

Clear current reference mappings.

static from_args(name, dtype, shape, region, approx_order=1, space='H1', poly_space_base='lagrange')[source]

Create a Field subclass instance corresponding to a given space.

Parameters:

name : str

The field name.

dtype : numpy.dtype

The field data type: float64 or complex128.

shape : int/tuple/str

The field shape: 1 or (1,) or ‘scalar’, space dimension (2, or (2,) or 3 or (3,)) or ‘vector’, or a tuple. The field shape determines the shape of the FE base functions and is related to the number of components of variables and to the DOF per node count, depending on the field kind.

region : Region

The region where the field is defined.

approx_order : int/str

The FE approximation order, e.g. 0, 1, 2, ‘1B’ (1 with bubble).

space : str

The function space name.

poly_space_base : str

The name of polynomial space base.

Notes

Assumes one cell type for the whole region!

static from_conf(conf, regions)[source]

Create a Field subclass instance based on the configuration.

get_dofs_in_region(region, merge=False, clean=False, warn=False, igs=None)[source]

Return indices of DOFs that belong to the given region.

get_mapping(ig, region, integral, integration, get_saved=False, return_key=False)[source]

For given region, integral and integration type, get a reference mapping, i.e. jacobians, element volumes and base function derivatives for Volume-type geometries, and jacobians, normals and base function derivatives for Surface-type geometries corresponding to the field approximation.

The mappings are cached in the field instance in mappings attribute. The mappings can be saved to mappings0 using Field.save_mappings. The saved mapping can be retrieved by passing get_saved=True. If the required (saved) mapping is not in cache, a new one is created.

Returns:

geo : CMapping instance

The reference mapping.

mapping : VolumeMapping or SurfaceMapping instance

The mapping.

key : tuple

The key of the mapping in mappings or mappings0.

save_mappings()[source]

Save current reference mappings to mappings0 attribute.

sfepy.discrete.common.fields.fields_from_conf(conf, regions)[source]
sfepy.discrete.common.fields.parse_approx_order(approx_order)[source]

Parse the uniform approximation order value (str or int).

sfepy.discrete.common.fields.parse_shape(shape, dim)[source]
sfepy.discrete.common.fields.setup_extra_data(conn_info)[source]

Setup extra data required for non-volume integration.