Skip to content

Force

cfsem.body_force_density_linear_filament

body_force_density_linear_filament(
    xyzfil: Array3xN,
    dlxyzfil: Array3xN,
    ifil: NDArray[float64],
    obs: Array3xN,
    j: Array3xN,
    wire_radius: float | NDArray[float64] = 0.0,
    par: bool = True,
) -> Array3xN

JxB (Lorentz) body force density (per volume) due to a linear current filament segment at an observation point with some current density (per area).

Parameters:

Name Type Description Default
xyzfil Array3xN

[m] x,y,z coords of current filament origins (start of segment)

required
dlxyzfil Array3xN

[m] x,y,z length delta of current filaments

required
ifil NDArray[float64]

[A] filament current

required
obs Array3xN

[m] x,y,z coords of observation locations

required
j Array3xN

[A/m^2] current density vector at observation locations

required
wire_radius float | NDArray[float64]

[m] filament radius, scalar or array of length m

0.0
par bool

Whether to use CPU parallelism

True

Returns:

Type Description
Array3xN

[N/m^3] body force density

Source code in cfsem/bindings.py
def body_force_density_linear_filament(
    xyzfil: Array3xN,
    dlxyzfil: Array3xN,
    ifil: NDArray[float64],
    obs: Array3xN,
    j: Array3xN,
    wire_radius: float | NDArray[float64] = 0.0,
    par: bool = True,
) -> Array3xN:
    """
    JxB (Lorentz) body force density (per volume) due to a linear current
    filament segment at an observation point with some current density (per area).

    Args:
        xyzfil: [m] x,y,z coords of current filament origins (start of segment)
        dlxyzfil: [m] x,y,z length delta of current filaments
        ifil: [A] filament current
        obs: [m] x,y,z coords of observation locations
        j: [A/m^2] current density vector at observation locations
        wire_radius: [m] filament radius, scalar or array of length `m`
        par: Whether to use CPU parallelism

    Returns:
        [N/m^3] body force density
    """
    xyzfil = _3tup_contig(xyzfil)
    dlxyzfil = _3tup_contig(dlxyzfil)
    ifil = ascontiguousarray(ifil).ravel()
    obs = _3tup_contig(obs)
    j = _3tup_contig(j)
    if asarray(wire_radius).ndim == 0:
        wire_radius = full(ifil.size, float(wire_radius))
    wire_radius = ascontiguousarray(wire_radius).ravel()
    jxbx, jxby, jxbz = em_body_force_density_linear_filament(
        xyzfil, dlxyzfil, ifil, obs, j, wire_radius, par
    )  # [N/m^3]

    return jxbx, jxby, jxbz  # type: ignore

cfsem.body_force_density_circular_filament_cartesian

body_force_density_circular_filament_cartesian(
    ifil: NDArray[float64],
    rfil: NDArray[float64],
    zfil: NDArray[float64],
    obs: Array3xN,
    j: Array3xN,
    par: bool = True,
) -> Array3xN

JxB (Lorentz) body force density (per volume) in cartesian form due to a circular current filament segment at an observation point in cartesian form with some current density (per area).

Parameters:

Name Type Description Default
ifil NDArray[float64]

[A] filament current

required
rfil NDArray[float64]

[m] filament R-coord

required
zfil NDArray[float64]

[m] filament Z-coord

required
obs Array3xN

[m] x,y,z coords of observation locations

required
j Array3xN

[A/m^2] current density vector at observation locations

required
par bool

Whether to use CPU parallelism

True

Returns:

Type Description
Array3xN

[N/m^3] body force density

Source code in cfsem/bindings.py
def body_force_density_circular_filament_cartesian(
    ifil: NDArray[float64],
    rfil: NDArray[float64],
    zfil: NDArray[float64],
    obs: Array3xN,
    j: Array3xN,
    par: bool = True,
) -> Array3xN:
    """
    JxB (Lorentz) body force density (per volume) in cartesian form due to a circular current
    filament segment at an observation point in cartesian form with some current density (per area).

    Args:
        ifil: [A] filament current
        rfil: [m] filament R-coord
        zfil: [m] filament Z-coord
        obs: [m] x,y,z coords of observation locations
        j: [A/m^2] current density vector at observation locations
        par: Whether to use CPU parallelism

    Returns:
        [N/m^3] body force density
    """
    ifil, rfil, zfil = _3tup_contig((ifil, rfil, zfil))
    obs = _3tup_contig(obs)
    j = _3tup_contig(j)
    jxbx, jxby, jxbz = em_body_force_density_circular_filament_cartesian(
        ifil, rfil, zfil, obs, j, par
    )  # [N/m^3]

    return jxbx, jxby, jxbz  # type: ignore