utilities.utils#
Functions#
|
Animate a sequence of scalar fields over a geometry. |
|
Determine whether the given input represents a real number. |
|
Refines a 1D array by subdividing each interval (x[i], x[i+1]) into n identical parts. |
|
If necessary, "roll" back intervals that cross boundary of periodic domain. |
|
Split a field into a list of fields that corresponds to the spaces. |
|
Split the flattened fem spaces into |
|
If necessary, "unroll" intervals that cross boundary of periodic domain. |
Details#
- refine_array_1d(x, n, remove_duplicates=True)[source]#
Refines a 1D array by subdividing each interval (x[i], x[i+1]) into n identical parts.
- Parameters:
- xndarray
1D array to be refined.
- nint
Number of subdivisions to be created in each interval (x[i], x[i+1]).
- remove_duplicatesbool, default=True
If True, the refined array will not contain any duplicate points. If False, the original internal grid points x[1:-1] will appear twice: this may be useful to visualize fields that are discontinuous across cell boundaries.
- Returns:
- ndarray
Refined 1D array. The length of this array is n * (len(x) - 1) + 1 if remove_duplicates and (n + 1) * (len(x) - 1) if not.
- unroll_edges(domain, xgrid)[source]#
If necessary, “unroll” intervals that cross boundary of periodic domain.
- split_space(Xh)[source]#
- Split the flattened fem spaces into
a list of spaces that corresponds to the symbolic function spaces.
- Parameters:
- XhProductFemSpace
The discrete space.
- Returns:
- Vh<list, FemSpace>
List of fem spaces.
- split_field(uh, spaces, out=None)[source]#
- Split a field into a list of fields that corresponds to the spaces.
The split field function will allocate new memory if out is not passed.
- Parameters:
- uhFemField
The fem field.
- spaces: <list, FemSpace>
List of spaces that split the field.
- out: optional, <list, FemField>
List of fields to write the results to.
- Returns:
- out<list, FemField>
List of fem fields.