sfepy.fem.dof_info module

Classes holding information on global DOFs and mapping of all DOFs - equations (active DOFs).

Helper functions for the equation mapping.

class sfepy.fem.dof_info.DofInfo(name)[source]

Global DOF information, i.e. ordering of DOFs of the state (unknown) variables in the global state vector.

append_raw(name, n_dof)[source]

Append raw DOFs.

Parameters:

name : str

The name of variable the DOFs correspond to.

n_dof : int

The number of DOFs.

append_variable(var, active=False)[source]

Append DOFs of the given variable.

Parameters:

var : Variable instance

The variable to append.

active : bool, optional

When True, only active (non-constrained) DOFs are considered.

get_info(var_name)[source]

Return information on DOFs of the given variable.

Parameters:

var_name : str

The name of the variable.

get_n_dof_total()[source]

Return the total number of DOFs of all state variables.

get_subset_info(var_names)[source]

Return global DOF information for selected variables only. Silently ignores non-existing variable names.

Parameters:

var_names : list

The names of the selected variables.

update(name, n_dof)[source]

Set the number of DOFs of the given variable.

Parameters:

name : str

The name of variable the DOFs correspond to.

n_dof : int

The number of DOFs.

class sfepy.fem.dof_info.EdgeDirectionOperator(name, nodes, region, field, dof_names, filename=None)[source]

Transformation matrix operator for edges direction LCBCs.

The substitution (in 3D) is:

System Message: WARNING/2 ([u_1, u_2, u_3]^T = [d_1, d_2, d_3]^T w, )

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.

where

System Message: WARNING/2 (\ul{d})

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
is an edge direction vector averaged into a node. The new DOF is

System Message: WARNING/2 (w)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
.

get_vectors(nodes, region, field, filename=None)[source]
class sfepy.fem.dof_info.EquationMap(name, dof_names, var_di)[source]

Map all DOFs to equations for active DOFs.

get_operator()[source]

Get the matrix operator

System Message: WARNING/2 (R)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
corresponding to the equation mapping, such that the restricted matrix

System Message: WARNING/2 (A_r)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
can be obtained from the full matrix

System Message: WARNING/2 (A)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
by

System Message: WARNING/2 (A_r = R^T A R)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
. All the matrices are w.r.t. a single variables that uses this mapping.

Returns:

mtx : coo_matrix

The matrix

System Message: WARNING/2 (R)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.

.

map_equations(bcs, field, ts, functions, problem=None, warn=False)[source]

Create the mapping of active DOFs from/to all DOFs.

Parameters:

bcs : Conditions instance

The Dirichlet or periodic boundary conditions (single condition instances). The dof names in the conditions must already be canonized.

field : Field instance

The field of the variable holding the DOFs.

ts : TimeStepper instance

The time stepper.

functions : Functions instance

The registered functions.

problem : ProblemDefinition instance, optional

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

warn : bool, optional

If True, warn about BC on non-existent nodes.

Returns:

active_bcs : set

The set of boundary conditions active in the current time.

Notes

  • Periodic bc: master and slave DOFs must belong to the same field (variables can differ, though).
class sfepy.fem.dof_info.IntegralMeanValueOperator(name, nodes, region, field, dof_names, filename=None)[source]

Transformation matrix operator for integral mean value LCBCs. All node DOFs are sumed to the new one.

class sfepy.fem.dof_info.LCBCOperator(**kwargs)[source]

Base class for LCBC operators.

treat_pbcs(dofs, master)[source]

Treat dofs with periodic BC.

class sfepy.fem.dof_info.LCBCOperators(name, eq_map, offset)[source]

Container holding instances of LCBCOperator subclasses for a single variable.

Parameters:

name : str

The object name.

eq_map : EquationMap instance

The equation mapping of the variable.

offset : int

The offset added to markers distinguishing the individual LCBCs.

add_from_bc(bc, field)[source]

Create a new LCBC operator described by bc, and add it to the container.

Parameters:

bc : LinearCombinationBC instance

The LCBC condition description.

field : Field instance

The field of the variable.

append(op)[source]
finalize()[source]

Call this after all LCBCs of the variable have been added.

Initializes the global column indices.

class sfepy.fem.dof_info.NoPenetrationOperator(name, nodes, region, field, dof_names, filename=None)[source]

Transformation matrix operator for no-penetration LCBCs.

class sfepy.fem.dof_info.NormalDirectionOperator(name, nodes, region, field, dof_names, filename=None)[source]

Transformation matrix operator for normal direction LCBCs.

The substitution (in 3D) is:

System Message: WARNING/2 ([u_1, u_2, u_3]^T = [n_1, n_2, n_3]^T w )

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.

The new DOF is

System Message: WARNING/2 (w)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
.

get_vectors(nodes, region, field, filename=None)[source]
class sfepy.fem.dof_info.RigidOperator(name, nodes, field, dof_names, all_dof_names)[source]

Transformation matrix operator for rigid LCBCs.

sfepy.fem.dof_info.expand_nodes_to_dofs(nods, n_dof_per_node)[source]

Expand DOF node indices into DOFs given a constant number of DOFs per node.

sfepy.fem.dof_info.expand_nodes_to_equations(nods, dof_names, all_dof_names)[source]

Expand vector of node indices to equations (DOF indices) based on the DOF-per-node count.

DOF names must be already canonized.

sfepy.fem.dof_info.group_chains(chain_list)[source]

Group EPBC chains.

sfepy.fem.dof_info.is_active_bc(bc, ts=None, functions=None)[source]

Check whether the given boundary condition is active in the current time.

Returns:

active : bool

True if the condition bc is active.

sfepy.fem.dof_info.make_global_lcbc_operator(lcbc_ops, adi, new_only=False)[source]

Assemble all LCBC operators into a single matrix.

Returns:

mtx_lc : csr_matrix

The global LCBC operator in the form of a CSR matrix.

lcdi : DofInfo

The global active LCBC-constrained DOF information.

new_only : bool

If True, the operator columns will contain only new DOFs.

sfepy.fem.dof_info.resolve_chains(master_slave, chains)[source]

Resolve EPBC chains - e.g. in corner nodes.