A finite element field variable.
field .. field description of variable (borrowed)
Apply essential (Dirichlet) and periodic boundary conditions to vector vec, starting at offset.
Apply initial conditions conditions to vector vec, starting at offset.
Convert the DOF vector to a dictionary of output data usable by Mesh.write().
| Parameters: | vec : array, optional
key : str, optional
extend : bool
fill_value : float or complex
linearization : Struct or None
|
|---|
Create the mapping of active DOFs from/to all DOFs.
Sets n_adof.
| Returns: | active_bcs : set
|
|---|
Evaluate various quantities related to the variable according to mode in quadrature points defined by integral.
The evaluated data are cached in the variable instance in evaluate_cache attribute.
| Parameters: | ig : int
mode : one of ‘val’, ‘grad’, ‘div’, ‘cauchy_strain’
region : Region instance, optional
integral : Integral instance, optional
integration : one of ‘volume’, ‘surface’, ‘surface_extra’
step : int, default 0
derivative : None or ‘dt’
is_trace : bool, default False
dt : float, optional
bf : Base function, optional
|
|---|---|
| Returns: | out : array
|
Evaluate self in the given physical coordinates. Convenience wrapper around Field.evaluate_at(), see its docstring for more details.
Return indices of variable components according to current term evaluation mode.
| Returns: | indx : list of tuples
|
|---|
Get element data dimensions for given approximation.
| Parameters: | ig : int
integral : Integral instance
integration : ‘volume’, ‘surface’, ‘surface_extra’ or ‘point’
region_name : str
|
|---|---|
| Returns: | data_shape : 5 ints
|
Notes
Get active dof connectivity of a variable.
Note that primary and dual variables must have same Region!
Get the full DOF vector satisfying E(P)BCs from a reduced DOF vector.
Notes
The reduced vector starts in r_vec at r_offset. Passing a force_value overrides the EBC values. Optionally, vec argument can be provided to store the full vector (in place) starting at offset.
Get the physical coordinates to interpolate into, based on the strategy used.
Get the reference element mapping of the underlying field.
See also
sfepy.fem.fields.Field.get_mapping
Get the reduced DOF vector, with EBC and PBC DOFs removed.
Notes
The full vector starts in vec at offset. If ‘follow_epbc’ is True, values of EPBC master DOFs are not simply thrown away, but added to the corresponding slave DOFs, just like when assembling. For vectors with state (unknown) variables it should be set to False, for assembled vectors it should be set to True.
Return base function gradient (space elements) values in quadrature points.
| Parameters: | ic : int, optional
ider : int, optional
|
|---|
Return variable gradient evaluated in quadrature points.
| Parameters: | ic : int, optional
ider : int, optional
|
|---|
| Returns: | flag : int
|
|---|
Invalidate variable data in evaluate cache for time step given by step (0 is current, -1 previous, ...).
This should be done, for example, prior to every nonlinear solver iteration.
Save the field mesh and the variable values into a file for visualization. Only the vertex values are stored.
Set current group data, initialize current DOF counter to None.
The current group data are the approximation, element data dimensions, base functions and base function gradients.
Set DOFs of variable using values in quadrature points corresponding to the given integral.
Set the variable using another variable. Undefined values (e.g. outside the other mesh) are set to numpy.nan, or extrapolated.
| Parameters: | strategy : ‘projection’ or ‘interpolation’
|
|---|
Notes
If the other variable uses the same field mesh, the coefficients are set directly.
If the other variable uses the same field mesh, only deformed slightly, it is advisable to provide directly the node ids as a hint where to start searching for a containing element; the order of nodes does not matter then.
Otherwise (large deformation, unrelated meshes, ...) there are basically two ways: a) query each node (its coordinates) using a KDTree of the other nodes - this completely disregards the connectivity information; b) iterate the mesh nodes so that the subsequent ones are close to each other - then also the elements of the other mesh should be close to each other: the previous one can be used as a start for the directional neighbour element crawling to the target point.
Not sure which way is faster, depends on implementation efficiency and the particular meshes.
Translate dof connectivity of the variable to active dofs.
Setup and cache base functions and base function gradients for given geometry. Also cache element data dimensions.
Store time step, set variable data for variables with the setter function.
Advance in time the DOF state history. A copy of the DOF vector is made to prevent history modification.
Get the dual variable.
| Returns: | var : Variable instance
|
|---|
Get the corresponding primary variable.
| Returns: | var : Variable instance
|
|---|
Set data (vector of DOF values) of the variable.
| Parameters: | data : array
indx : int, optional
step : int, optional
preserve_caches : bool
|
|---|
Container holding instances of Variable.
Apply essential (Dirichlet) and periodic boundary conditions defined for the state variables to vector vec.
Apply initial conditions defined for the state variables to vector vec.
Check whether the shape of the DOF vector corresponds to the total number of DOFs of the state variables.
| Parameters: | vec : array
stripped : bool
|
|---|
Create the mapping of active DOFs from/to all DOFs for all state variables.
| Returns: | active_bcs : set
|
|---|
This method resets the variable counters for automatic order!
Return parts of a state vector corresponding to individual state variables.
| Parameters: | vec : array, optional
|
|---|---|
| Returns: | out : dict
|
Link state variables with corresponding virtual variables, and assign link to self to each variable instance.
Usually, when solving a PDE in the weak form, each state variable has a corresponding virtual variable.
Make a full DOF vector satisfying E(P)BCs from a reduced DOF vector.
Passing a force_value overrides the EBC values.
Set data (vectors of DOF values) of variables.
| Parameters: | data : array
step : int, optional
ignore_unknown : bool, optional
preserve_caches : bool
|
|---|
Set variables with names in var_names from state variables with names in var_names_state using DOF values in the state vector state.
Translate dofs to active dofs. Active dof connectivity key = (variable.name, region.name, type, ig)
Setup data types of state variables - all have to be of the same data type, one of nm.float64 or nm.complex128.
Prepare linear combination BC operator matrix.
Convert a state vector to a dictionary of output data usable by Mesh.write().
Get the reduced DOF vector, with EBC and PBC DOFs removed.
Notes
If ‘follow_epbc’ is True, values of EPBC master dofs are not simply thrown away, but added to the corresponding slave dofs, just like when assembling. For vectors with state (unknown) variables it should be set to False, for assembled vectors it should be set to True.