sfepy.fem.domain module

Computational domain, consisting of the mesh and regions.

class sfepy.fem.domain.Domain(name, mesh, verbose=False)[source]

Domain is divided into groups, whose purpose is to have homogeneous data shapes.

clear_surface_groups()[source]

Remove surface group data.

create_region(name, select, flags=None, check_parents=True, functions=None, add_to_regions=True)[source]

Region factory constructor. Append the new region to self.regions list.

create_regions(region_defs, functions=None)[source]
create_surface_group(region)[source]

Create a new surface group corresponding to region if it does not exist yet.

Notes

Surface groups define surface facet connectivity that is needed for sfepy.fem.mappings.SurfaceMapping.

fix_element_orientation()[source]

Ensure element nodes ordering giving positive element volume.

The groups with elements of lower dimension than the space dimension are skipped.

get_cell_offsets()[source]
get_conns()[source]

Return the element connectivity groups of the underlying mesh.

get_diameter()[source]

Return the diameter of the domain.

Notes

The diameter corresponds to the Friedrichs constant.

get_element_diameters(ig, cells, vg, mode, square=True)[source]
get_facets(force_faces=False)[source]

Return edge and face descriptions.

get_mesh_bounding_box()[source]

Return the bounding box of the underlying mesh.

Returns:

bbox : ndarray (2, dim)

The bounding box with min. values in the first row and max. values in the second row.

get_mesh_coors(actual=False)[source]

Return the coordinates of the underlying mesh vertices.

has_faces()[source]
iter_groups(igs=None)[source]
refine()[source]

Uniformly refine the domain mesh.

Returns:

domain : Domain instance

The new domain with the refined mesh.

Notes

Works only for meshes with single element type! Does not preserve node groups!

reset_regions()[source]

Reset the list of regions associated with the domain.

save_regions(filename, region_names=None)[source]

Save regions as individual meshes.

Parameters:

filename : str

The output filename.

region_names : list, optional

If given, only the listed regions are saved.

save_regions_as_groups(filename, region_names=None)[source]

Save regions in a single mesh but mark them by using different element/node group numbers.

If regions overlap, the result is undetermined, with exception of the whole domain region, which is marked by group id 0.

Region masks are also saved as scalar point data for output formats that support this.

Parameters:

filename : str

The output filename.

region_names : list, optional

If given, only the listed regions are saved.

setup_facets(create_edges=True, create_faces=True, verbose=False)[source]

Setup the edges and faces (in 3D) of domain elements.

setup_groups()[source]
surface_faces()[source]
sfepy.fem.domain.region_leaf(domain, regions, rdef, functions)[source]

Create/setup a region instance according to rdef.

sfepy.fem.domain.region_op(level, op, item1, item2)[source]