Magnetics: Line, Surface, and Volume Integrals

Integrate fields along paths, over surfaces, and through volumes. Check how orientation, normals, and axis order affect the result.

Orient paths and faces

An ordered path defines the integration direction. Triangular face indices are one-based, and the vertex order sets the normal. On a triangle of area 0.5 with a normal field component of 2, the flux is +1. Swapping two vertices changes it to −1. Before integrating over a volume, check that the axes match the sample dimensions.

Operation reference

Jump to an operation

integral.line

A contains the ordered path and B the field evaluated at the path points. The path orientation determines the sign of the integral.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Line integral of a field
gxtxt_api_call("MAGNETICS_API_v1", "integral.line", args)
Recorded result · integral.line

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      0.0,
      1.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      1,
      1,
      1,
      1,
      0,
      0,
      0,
      0,
      0,
      0
    ]
  },
  {
    "kind": "empty"
  }
]

Result preview

{
  "value_real": 0.0,
  "value_imaginary": 0.0
}

integral.circulation

A defines the path and B the field. Repeat the starting point when needed to close the contour.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Field circulation
gxtxt_api_call("MAGNETICS_API_v1", "integral.circulation", args)
Recorded result · integral.circulation

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      0.0,
      1.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      1,
      1,
      1,
      1,
      0,
      0,
      0,
      0,
      0,
      0
    ]
  },
  {
    "kind": "empty"
  }
]

Result preview

{
  "value_real": 0.0,
  "value_imaginary": 0.0
}

integral.mmf

A is the path and B is the H field in A/m. Integrating over distance in m gives the magnetomotive force.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Magnetomotive force along a path
gxtxt_api_call("MAGNETICS_API_v1", "integral.mmf", args)
Recorded result · integral.mmf

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      0.0,
      1.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      4,
      3
    ],
    "real": [
      1,
      1,
      1,
      1,
      0,
      0,
      0,
      0,
      0,
      0
    ]
  },
  {
    "kind": "empty"
  }
]

Result preview

{
  "value_real": 0.0,
  "value_imaginary": 0.0
}

integral.surface_flux

A contains the vertices in m, B the per-face values, and C the triangles with one-based indices. For flux in Wb, supply the flux density in T.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Flux through an oriented surface
gxtxt_api_call("MAGNETICS_API_v1", "integral.surface_flux", args)
Recorded result · integral.surface_flux:reverse

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      3,
      3
    ],
    "real": [
      0.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      0,
      0,
      2
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      1,
      3,
      2
    ]
  }
]

Result preview

{
  "value_real": -1.0,
  "value_imaginary": 0.0
}

integral.flux

A and C define the ordered mesh and B is the field on the triangles. Check each face normal before comparing results.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Flux
gxtxt_api_call("MAGNETICS_API_v1", "integral.flux", args)
Recorded result · integral.flux

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      3,
      3
    ],
    "real": [
      0.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      0,
      0,
      2
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      1,
      2,
      3
    ]
  }
]

Result preview

{
  "value_real": 1.0,
  "value_imaginary": 0.0
}

integral.volume

A contains the axes and B the sampled scalar field. Match the axes to the dimensions for the three-dimensional integral.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Volume integral
gxtxt_api_call("MAGNETICS_API_v1", "integral.volume", args)
Recorded result · integral.volume

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "cell",
    "shape": [
      1,
      3
    ],
    "items": [
      {
        "kind": "array",
        "shape": [
          3,
          1
        ],
        "real": [
          0.0,
          1.0,
          3.0
        ]
      },
      {
        "kind": "array",
        "shape": [
          3,
          1
        ],
        "real": [
          0.0,
          1.0,
          3.0
        ]
      },
      {
        "kind": "array",
        "shape": [
          3,
          1
        ],
        "real": [
          0.0,
          1.0,
          3.0
        ]
      }
    ]
  },
  {
    "kind": "array",
    "shape": [
      3,
      3,
      3
    ],
    "real": [
      0.0,
      1.0,
      3.0,
      2.0,
      3.0,
      5.0,
      6.0,
      7.0,
      9.0,
      3.0
    ]
  },
  {
    "kind": "empty"
  }
]

Result preview

{
  "value_real": 243.0,
  "value_imaginary": 0.0
}

integral.power

A and C define the surface and B supplies the power flux density. Integrating a density in W/m² over an area in m² gives power in W.

Access
Registered in the Python Job
Arguments
Typed operands a, b, and c, with an optional typed options struct.
Shape
Path, vertices, or grid | field | triangles (path_or_vertices_or_grid;field;triangles)
Units
Field units multiplied by the units of length, area, or volume
Result
Numerical and diagnostic fields
Purpose
Poynting flux through an oriented triangulated surface
gxtxt_api_call("MAGNETICS_API_v1", "integral.power", args)
Recorded result · integral.power

Download the example script (ZIP).

Example operands preview

[
  {
    "kind": "array",
    "shape": [
      3,
      3
    ],
    "real": [
      0.0,
      1.0,
      0.0,
      0.0,
      0.0,
      1.0,
      0.0,
      0.0,
      0.0
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      0,
      0,
      2
    ]
  },
  {
    "kind": "array",
    "shape": [
      1,
      3
    ],
    "real": [
      1,
      2,
      3
    ]
  }
]

Result preview

{
  "value_real": 1.0,
  "value_imaginary": 0.0,
  "unit": "W"
}