Overview
Thefield module provides classes for representing data fields in spectral space. Fields can be scalars, vectors, or tensors, and support arithmetic operations, differential operators, and layout transformations between grid and coefficient space.
Field Classes
Field
Parameters
- dist (Distributor, optional): Distributor object for parallelization
- bases (tuple of Basis, optional): Spectral bases for each dimension
- tensorsig (tuple of CoordinateSystems, optional): Tensor signature
- dtype (dtype, optional): Data type (default: np.float64)
- name (str, optional): Field name
Attributes
- data (ndarray): Field data in current layout
- layout: Current data layout (‘c’ for coefficients, ‘g’ for grid)
- domain (Domain): Field domain
- tensorsig (tuple): Tensor signature
Methods
[‘g’] - Access grid-space dataArithmetic Operations
Fields support standard arithmetic:Example
ScalarField
Example
VectorField
Parameters
- coordsys (CoordinateSystem): Coordinate system for vector components
- Other parameters same as Field
Example
TensorField
Parameters
- coordsys_out (CoordinateSystem): Output coordinate system
- coordsys_in (CoordinateSystem, optional): Input coordinate system (default: same as output)
- Other parameters same as Field
Example
Field Properties
Tensor Operations
T - Transpose tensor componentsComponent Access
real - Real partAdvanced Usage
Non-Constant Coefficients (NCCs)
Fields can be used as non-constant coefficients in equations:Interpolation
Fields can be called to interpolate:See Also
- Basis - Spectral bases for fields
- Operators - Differential and other operators
- Distributor - Parallel distribution
- Problems - Using fields in equations