Skip to content
Agentmart
Submit a tool

analyze-magnetic-field

Calculate and visualize magnetic fields produced by current distributions using the Biot-Savart law, Ampere's law, and magnetic dipole approximations.

Skill by Philipp Thoss

IndexedMIT★ 42
Write a review

Chalk Labs

Need help deploying analyze-magnetic-field?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code. Read the repository before you give any tool access to your data.

npx agentmarket install skill/pjt222-analyze-magnetic-field

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Calculate and visualize magnetic fields produced by current distributions using the Biot-Savart law, Ampere's law, and magnetic dipole approximations. Use when computing B-fields from arbitrary current geometries, exploiting symmetry with Ampere's law, analyzing superposition of multiple sources, or characterizing magnetic materials through permeability, B-H curves, and hysteresis behavior.

Use cases: legal

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/analyze-magnetic-field

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read
  • Grep
  • Glob
  • WebFetch
  • WebSearch

What's inside

Skill name
analyze-magnetic-field
Description
Calculate and visualize magnetic fields produced by current distributions using the Biot-Savart law, Ampere's law, and magnetic dipole approximations. Use when computing B-fields from arbitrary current geometries, exploiting symmetry with Ampere's law, analyzing superposition of multiple sources, or characterizing magnetic materials through permeability, B-H curves, and hysteresis behavior.
License
MIT
Allowed tools
Read, Grep, Glob, WebFetch, WebSearch
Metadata
tags: electromagnetism, magnetic-fields, biot-savart, ampere, magnetic-materials · author: Philipp Thoss · domain: electromagnetism · version: 1.0 · language: natural · complexity: intermediate
Instructions
214 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Analyze Magnetic Field

Calculate the magnetic field produced by a given current distribution by characterizing the source geometry, selecting the appropriate law (Biot-Savart for arbitrary geometries, Ampere's law for high-symmetry configurations), evaluating field integrals, checking limiting cases, incorporating magnetic material effects where relevant, and visualizing the resulting field-line topology.

## When to Use

- Computing the B-field from an arbitrary current-carrying conductor (wire loop, helix, irregular path)
- Exploiting cylindrical, planar, or toroidal symmetry to apply Ampere's law directly
- Estimating far-field behavior via the magnetic dipole approximation
- Superposing fields from multiple current sources
- Analyzing magnetic materials: linear permeability, B-H curves, hysteresis, saturation

## Inputs

- **Required**: Current distribution specification (geometry, current magnitude and direction)
- **Required**: Region of interest where the field is needed (observation points or volume)
- **Optional**: Material properties (relative permeability, B-H curve data, coercivity, remanence)
- **Optional**: Desired accuracy level (exact integral, multipole expansion order, numerical resolution)
- **Optional**: Visualization requirements (2D cross-section, 3D field lines, magnitude contour map)

## Procedure

### Step 1: Characterize Current Distribution and Geometry

Fully specify the source before selecting a method:

1. **Current path**: Describe the geometry of every current-carrying element. For line currents, specify the path as a parametric curve r'(t). For surface currents, specify the surface current density K (A/m). For volume currents, specify J (A/m^2).
2. **Coordinate system**: Choose coordinates aligned with the dominant symmetry. Cylindrical (rho, phi, z) for wires and solenoids. Spherical (r, theta, phi) for dipoles and loops at large distances. Cartesian for planar sheets.
3. **Symmetry analysis**: Identify translational, rotational, and reflection symmetries. A symmetry of the source is a symmetry of the field. Document which components of B are nonzero by symmetry and which vanish.
4. **Current continuity**: Verify that the current distribution satisfies div(J) = 0 (steady state) or div(J) = -d(rho)/dt (time-varying). Inconsistent current distributions produce unphysical fields.

```markdown
## Source Characterization
- **Current type**: [line I / surface K / volume J]
- **Geometry**: [parametric description]
- **Coordinate system**: [and justification]
- **Symmetries**: [translational / rotational / reflection]
- **Nonzero B-components by symmetry**: [list]
- **Current continuity**: [verified / issue noted]
```

**Got:** A complete geometric description of the current distribution with coordinate system chosen, symmetries cataloged, and current continuity verified.

**If fail:** If the geometry is too complex for a closed-form parametric description, discretize into short straight segments (numerical Biot-Savart). If current continuity is violated, add displacement current or return charge accumulation terms before proceeding.

### Step 2: Select Appropriate Law

Choose the method that matches the problem's symmetry and complexity:

1. **Ampere's law** (high symmetry): Use when the current distribution has sufficient symmetry that B can be pulled out of the line integral. Applicable cases:
   - Infinite straight wire (cylindrical symmetry) -> circular Amperian loop
   - Infinite solenoid (translational + rotational) -> rectangular Amperian loop
   - Toroid (rotational about the ring axis) -> circular Amperian loop
   - Infinite planar current sheet (translational in two directions) -> rectangular loop

2. **Biot-Savart law** (general): Use for arbitrary geometries where Ampere's law cannot simplify:
   - dB = (mu_0 / 4 pi) * (I dl' x r_hat) / r^2
   - For volume currents: B(r) = (mu_0 / 4 pi) * integral of (J(r') x r_hat) / r^2 dV'

3. **Magnetic dipole approximation** (far field): Use when the observation point is far from the source (r >> source dimension d):
   - Compute the magnetic dipole moment: m = I * A * n_hat (for a planar loop of area A)
   - B_dipole(r) = (mu_0 / 4 pi) * [3(m . r_hat) r_hat - m] / r^3
   - Valid when r/d > 5 for ~1% accuracy

4. **Superposition**: For multiple sources, compute B from each independently and sum vectorially. Linearity of Maxwell's equations guarantees this is exact.

```markdown
## Method Selection
- **Primary method**: [Ampere / Biot-Savart / dipole]
- **Justification**: [symmetry argument or distance criterion]
- **Expected complexity**: [closed-form / single integral / numerical]
- **Fallback method**: [if primary fails or for cross-validation]
```

**Got:** A justified choice of method with a clear statement of why the chosen law is appropriate for the problem's symmetry level.

**If fail:** If Ampere's law is chosen but the symmetry is insufficient (B cannot be extracted from the integral), fall back to Biot-Savart. If the source geometry is too complex for analytic Biot-Savart, discretize numerically.

### Step 3: Set Up and Evaluate Field Integrals

Execute the calculation using the method selected in Step 2:

1. **Ampere's law path**: For each Amperian loop:
   - Parameterize the loop path and compute the line integral of B . dl
   - Compute the enclosed current I_enc by counting all currents threading the loop
   - Solve: contour_integral(B . dl) = mu_0 * I_enc
   - Extract B from the integral using the symmetry established in Step 1

2. **Biot-Savart integration**: For each field point r:
   - Parameterize the source: dl' = (dr'/dt) dt or express J(r') over the volume
   - Compute the displacement vector: r - r' and its magnitude |r - r'|
   - Evaluate the cross product: dl' x (r - r') or J x (r - r')
   - Integrate over the source (line, surface, or volume)
   - For analytic evaluation: exploit symmetry to reduce dimensionality (e.g., on-axis field of a loop involves only one integral)
   - For numerical evaluation: discretize into N segments, compute the sum, and check convergence by doubling N

3. **Dipole calculation**:
   - Compute total magnetic moment: m = (1/2) integral of (r' x J) dV' for volume currents, or m = I * A * n_hat for a planar loop
   - Apply the dipole field formula at each observation point
   - Estimate the error: the next multipole (quadrupole) correction scales as (d/r)^4

4. **Superposition assembly**: Sum contributions from all sources at each observation point. Track components separately to preserve cancellation accuracy.

```markdown
## Field Calculation
- **Integral setup**: [explicit expression]
- **Evaluation method**: [analytic / numeric with N segments]
- **Result**: B(r) = [expression with units]
- **Convergence check** (if numerical): [N vs. 2N comparison]
```

**Got:** An explicit expression for B(r) at the observation points, with correct units (Tesla or Gauss) and a convergence check for numerical results.

**If fail:** If the integral diverges, check for a missing regularization (e.g., the field on the wire itself diverges for an infinitely thin wire -- use finite wire radius). If numerical results oscillate with N, the integrand has a near-singularity that requires adaptive quadrature or analytical subtraction of the singular part.

### Step 4: Check Limiting Cases

Verify the result against known physics before trusting it:

From pjt222/agent-almanac, MIT.

More from pjt222/agent-almanac

Signals

Stars
42
Forks
5
Open issues
182
Last commit (this folder)
Aug 17, 2026 (2 months ago)
Last release
Aug 26, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Philipp Thoss

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get analyze-magnetic-field running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying analyze-magnetic-field?

CallGet help
Cite this page

analyze-magnetic-field skill. Agent Mart. https://agentmart.dev/skills/pjt222-analyze-magnetic-field (last updated 2026-10-24)