> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ionworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Simulation Spatial Field

> Evaluate a 2D/3D field on an unstructured mesh from stored solution chunks.

Returns the mesh as a VTK unstructured grid plus the field's cell values at up
to ``max_time_points`` stored times, for rendering with vtk.js.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json get /simulations/{simulation_id}/spatial-field
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /simulations/{simulation_id}/spatial-field:
    get:
      tags:
        - Simulations
      summary: Get Simulation Spatial Field
      description: >-
        Evaluate a 2D/3D field on an unstructured mesh from stored solution
        chunks.


        Returns the mesh as a VTK unstructured grid plus the field's cell values
        at up

        to ``max_time_points`` stored times, for rendering with vtk.js.
      operationId: >-
        get_simulation_spatial_field_simulations__simulation_id__spatial_field_get
      parameters:
        - name: simulation_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Simulation Id
        - name: variable
          in: query
          required: true
          schema:
            type: string
            title: Variable
        - name: max_time_points
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            default: 60
            title: Max Time Points
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpatialField'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SpatialField:
      properties:
        variable:
          type: string
          title: Variable
          description: Evaluated PyBaMM variable name.
        dimension:
          type: integer
          enum:
            - 2
            - 3
          title: Dimension
          description: Number of meshed spatial axes (2 = x-z plane, 3 = x-y-z).
        axis_names:
          items:
            type: string
          type: array
          title: Axis Names
          description: Physical axis of each point coordinate, e.g. ['x', 'y', 'z'].
        n_points:
          type: integer
          title: N Points
          description: Number of mesh vertices.
        points:
          type: string
          title: Points
          description: >-
            Base64 float32 xyz triples in metres, n_points * 3 values. A 2D mesh
            has z = 0.
        n_cells:
          type: integer
          title: N Cells
          description: Number of mesh cells.
        nodes_per_cell:
          type: integer
          title: Nodes Per Cell
          description: Vertices per cell.
        cell_type:
          type: integer
          title: Cell Type
          description: >-
            VTK cell-type code: 5 triangle, 9 quad, 10 tetrahedron, 12
            hexahedron.
        connectivity:
          type: string
          title: Connectivity
          description: >-
            Base64 int32 vertex indices, n_cells * nodes_per_cell values in VTK
            node order.
        association:
          type: string
          enum:
            - cell
            - point
          title: Association
          description: Whether values are per cell or per vertex.
        times:
          items:
            type: number
          type: array
          title: Times
          description: Sampled simulation times in seconds.
        values:
          type: string
          title: Values
          description: >-
            Base64 float32 field values, time-major: len(times) blocks of
            n_cells (or n_points) values.
        value_range:
          items:
            type: number
          type: array
          title: Value Range
          description: '[min, max] of the finite values over every sampled time.'
        domains:
          items:
            type: string
          type: array
          title: Domains
          description: PyBaMM domains the field spans.
      type: object
      required:
        - variable
        - dimension
        - axis_names
        - n_points
        - points
        - n_cells
        - nodes_per_cell
        - cell_type
        - connectivity
        - association
        - times
        - values
        - value_range
      title: SpatialField
      description: >-
        A time-dependent scalar field on an unstructured 2D or 3D PyBaMM mesh.


        Shaped for a VTK unstructured grid. ``points``, ``connectivity`` and
        ``values``

        are base64-encoded little-endian typed arrays: decode them straight into
        a

        ``Float32Array`` / ``Int32Array`` / ``Float32Array``.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.