pdemagic

State a partial differential equation as you would write it down. pdemagic chooses the method, the grid and every setting, solves it, and tells you what it did. Every choice it makes can be inspected and overridden.

import sympy as sp
import pdemagic as pm

x, y = sp.symbols("x y", real=True)
w = sp.Function("w")(x, y)


def antenna(centre):
    return sp.exp(-8 * ((x - centre) ** 2 + y**2))


# Waves of one frequency from two sources, radiating into free space.
problem = pm.Problem(
    sp.Eq(pm.laplacian(w) + 36 * w, -(antenna(-1.5) + antenna(1.5))),
    domain=pm.FreeSpace(x, y),
)
pm.solve(problem).plot(part="real")
The figure that the example above draws. The figure that the example above draws.

No box was chosen here, no boundary condition invented and no grid set up. pdemagic recognised the equation, found where the sources are, left room for the waves, and picked a grid that resolves them. pm.plan(problem) shows all of it, and lets you change any of it.

First steps

New to pdemagic? Start here.

How the documentation is organized

There are four kinds of pages, and each kind does one thing.

  • The tutorial takes you by the hand through a series of problems. Start here if pdemagic is new to you.

  • Topics explain one concept each: what a domain is, how a boundary condition is stated, what the planner decides.

  • How-to guides are recipes. They take you through the steps of one task, and assume that you know what you want.

  • The reference is complete and dry: every class and function, every equation that is solved on every domain, every setting of a plan, and what does not work yet.

Beside them stand the gallery, where every picture is drawn by the code above it, and the methods, which say how each problem is solved and how accurate that is.

Stating a problem

Kinds of problems

The solve and its result

How it works

  • Methods: which method is used when, and a page for each: how it works, how accurate it is, what it costs, and where its limits are.

The project

Note

pdemagic is young: this is version 0.1. What is solved where has the details, and the known limits say what does not work yet.