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")
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.
From scratch: pdemagic at a glance · Installation
Tutorial: 1: A first problem · 2: A heated plate · 3: Heat and waves · 4: What pdemagic decided · 5: A shape of your own · 6: Tones and states
See what it can do: the gallery, with one page for each example
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¶
Equations: Problems, unknowns and equations ·
pm.ProblemDomains: the families · free space and periodic directions · boxes with walls · disks, balls and cylinders · shapes in the plane · reference: domains, regions and curves · how to: make one direction periodic, draw a shape with holes, name the pieces of a boundary
Boundary conditions: values, slopes and mixes · how to: one condition for all faces, different conditions on each face, a wall that lets waves out, clamp a plate
What a problem is given: data from arrays · bodies · reference: data and bodies · how to: use measured data as a source, start from an array, put a conductor in a field
Kinds of problems¶
Stationary: stationary equations · waves of one frequency · media and potentials · nonlinear equations · beams and plates · how to: pick the solution that Newton’s method finds
In time: problems in time · nonlinear equations in time
Eigenproblems: bound states · modes of cavities, drums and waveguides · how to: ask for more modes
More than one real unknown: systems · complex unknowns
What is solved where: the overview · free space · boxes · round domains · shapes · known limits
The solve and its result¶
The plan: the planner and its plan · reference:
pm.planandpm.solve, the methods of a plan · how to: read what was decided, choose the grid yourself, choose the times that are recorded, reuse a plan, set the number of threadsAccuracy: accuracy and diagnostics · reference: diagnostics, how accurate it is, errors · how to: get more digits, what to do when a plan says NOT resolved
Results: solutions · plotting · reference:
Solution· how to: evaluate at a point, get the arrays and the grid, integrate a solution, save and load a solution, plot a section in three dimensions, animate a solution, draw into your own figure
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¶
Help: questions that come up · glossary
Over time: release notes · roadmap
Inside: the project: architecture, decisions, backlog and the records of its milestones
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.