Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions book/0_overview/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

## Programming

Struggling to remember how to use Python? You can check those resources:

* [Introduction to Python](https://teachbooks.io/introduction_to_python/main/intro.html) from *Exploring the Grand Challenges* to refresh your memory.
* [Python Cheatsheet](https://labex.io/pythoncheatsheet/) for quick overviews starting from the very basics.
* [Think Python](https://allendowney.github.io/ThinkPython/index.html), an entire book for more in-depth explanations.

Struggling to remember how to use a Python package? Here are some nice summaries for the main packages you will use in this course:

* **NumPy**: [the absolute basics for beginners](https://numpy.org/doc/stable/user/absolute_beginners.html)
* **Matplotlib**: [quick start guide](https://matplotlib.org/stable/users/explain/quick_start.html)
* **pandas**: [10 minutes to pandas](https://pandas.pydata.org/docs/user_guide/10min.html)

In general, the main Python packages have extensive documentations, and it is always a good idea to check them.
3 changes: 3 additions & 0 deletions book/0_overview/schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Weekly schedule

Click on the dropdown blocks below to find the schedule of each week's activities.
1 change: 1 addition & 0 deletions book/1_gradient_divergence_curl/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Introduction
1 change: 1 addition & 0 deletions book/2_potential_fields/gravity_field/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Gravity Field
206 changes: 206 additions & 0 deletions book/2_potential_fields/introduction/conservative_fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Conservative Fields

In general, the line integral in {eq}`eq:work-integrated-work` could depend on the path followed between two points. A force field is called conservative when the work done by the field between two points does not depend on the path taken between them.

In other words, for any two paths $s_1$ and $s_2$ that start at the same point $P_0$ and end at the same point $P_1$,

$$
\int_{s_1} \vec{F}\cdot\vec{ds}
=
\int_{s_2} \vec{F}\cdot\vec{ds}.
$$

Earth's gravitational field is an example of a conservative field: the work depends only on the starting and ending positions, not on the detailed route taken between them.

```{admonition} Exercise: a non-conservative field
Show that the two-dimensional vector field

$$
\vec{F}(x,y) = -y\,\hat{x} + x\,\hat{y}
$$

is not conservative.

To do this, calculate the work done by the field around a circle of radius $R$ centered at the origin:

$$
\vec{r}(\theta) = R\cos\theta\,\hat{x} + R\sin\theta\,\hat{y},
\qquad 0 \leq \theta \leq 2\pi.
$$

1. Calculate the differential displacement $d\vec{s}$ along the circle.
2. Evaluate $\vec{F}\cdot d\vec{s}$ on the circle.
3. Compute the closed line integral

$$
\oint \vec{F}\cdot d\vec{s}.
$$

4. Explain why your result shows that the field is not conservative.
```

```{dropdown} Solution
Along the circle,

$$
d\vec{s}
=
-R\sin\theta\,d\theta\,\hat{x}
+
R\cos\theta\,d\theta\,\hat{y}.
$$

The field evaluated on the circle is

$$
\vec{F}
=
-R\sin\theta\,\hat{x}
+
R\cos\theta\,\hat{y}.
$$

Therefore,

$$
\vec{F}\cdot d\vec{s}
=
R^2\,d\theta.
$$

The work around the closed path is

$$
\oint \vec{F}\cdot d\vec{s}
=
\int_0^{2\pi} R^2\,d\theta
=
2\pi R^2.
$$

This is not zero. A conservative field must have zero work around any closed path, so this field is not conservative.
```

```{admonition} Physical example: magnetic field around a wire
We will come back to magnetic fields later in the course, so for now we simply postulate the following result.

An infinitely long straight wire along the $z$ axis, carrying a steady current $I$, produces a magnetic field that circles around the wire:

$$
\vec{B}(\rho) = \frac{\mu_0 I}{2\pi \rho}\,\hat{\phi}.
$$

Here $\rho$ is the distance from the $z$ axis. The direction $\hat{\phi}$ is the direction tangent to a circle around the wire. If you look along the positive $z$ direction, $\hat{\phi}$ points counterclockwise around the wire.

For a circular path of radius $\rho$ centered on the wire, the small displacement along the path is

$$
d\vec{s} = \rho\,d\phi\,\hat{\phi}.
$$

Therefore,

$$
\vec{B}\cdot d\vec{s}
=
\frac{\mu_0 I}{2\pi \rho}\,\hat{\phi}
\cdot
\rho\,d\phi\,\hat{\phi}
=
\frac{\mu_0 I}{2\pi}\,d\phi.
$$

Integrating once around the circle gives

$$
\oint \vec{B}\cdot d\vec{s}
=
\int_0^{2\pi} \frac{\mu_0 I}{2\pi}\,d\phi
=
\mu_0 I.
$$

This result is not zero, so this magnetic field is not conservative. This equation is a preview of Ampere's law, which we will study properly when we discuss electromagnetic fields.
```

Let is now consider the work done by a conservative force field to go from $P_0$ to an arbitrary point $P$,

$$
W(P_0,P) = \int_{P_0}^P \vec{F}(x,y,z) \cdot \vec{ds},
$$

and to a point desplaced in the x-direction,

$$
W(P_0,P+\Delta x \cdot \hat{x}) = \int_{P_0}^{P+\Delta x \cdot \hat{x}} \vec{F}(x,y,z) \cdot \vec{ds}.
$$

Becase the path does not matter, we can go first from $P_0$ to $P$ and from there to $P+\Delta x \cdot \hat{x}$, so we have

$$
W(P_0,P+\Delta x \cdot \hat{x}) = W(P_0,P) + W(P,P+\Delta x \cdot \hat{x}),
$$

or

$$
W(P_0,P+\Delta x \cdot \hat{x}) - W(P_0,P) = W(P,P+\Delta x \cdot \hat{x}) = \int_{P}^{P+\Delta x \cdot \hat{x}} \vec{F}(x,y,z) \cdot \vec{ds}.
$$

If we go in a straight line to $P+\Delta x \cdot \hat{x}$, the path diferencial becomes

$$
\vec{ds} = dx\cdot \hat{x}.
$$

When we do the inner-product by the force field,

$$
\vec{F}(x,y,z) = F_x(x,y,z) \hat{x} + F_y(x,y,z) \hat{y} + F_z(x,y,z) \hat{z},
$$

only the x component of the field matters (because $\hat{x}\cdot\hat{y} = \hat{x}\cdot\hat{z} = 0$),

$$
\vec{F}(x,y,z) \cdot \vec{ds} = \vec{F}(x,y,z) \cdot dx \cdot \hat{x} = F_x(x,y,z) \cdot dx.
$$

So combining with the previous we have

$$
W(P_0,P+\Delta x \cdot \hat{x}) - W(P_0,P) = \int_{P}^{P+\Delta x \cdot \hat{x}} F_x(x,y,z)\,dx.
$$

Now we can go towards the partial derivative of the work with respect to $x$:

$$
\frac{\partial W}{\partial x}
=
\lim_{\Delta x \to 0}
\frac{W(P_0,P+\Delta x \cdot \hat{x}) - W(P_0,P)}{\Delta x}
=
\lim_{\Delta x \to 0}
\frac{1}{\Delta x}
\int_{P}^{P+\Delta x \cdot \hat{x}} F_x(x,y,z)\,dx
=
F_x(P).
$$

or, in a more compact form:

$$
\frac{\partial W}{\partial x} = F_x
$$

We could repeat the derivation for displacements in the y and z direction, respectively. Combining, we have

$$
\vec{\nabla} W = \vec{F}.
$$ (eq:work_is_gradient_of_work)

In *words*, {eq}`eq:work_is_gradient_of_work` tells us:

- The force field is the gradient of the work;
- The vector field, $\vec{F}$, is fully determined by the scalar field, $W$.

Any vector field that can be constructed as the gradient of a *work* function, i.e. by {eq}`eq:work_is_gradient_of_work`, is a **conservative field**..
262 changes: 262 additions & 0 deletions book/2_potential_fields/introduction/earth_gravity_work.ipynb

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions book/2_potential_fields/introduction/fundamentals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fundamentals

## Field

A field is a function, or set of functions, in time and space, for example

$$
y = f(x,y,z,t)
$$

In this section of the course we address *force* fields, such as the gravitational field defining the trajectory of a satellite, or the electric field actuating on a charge. The force field itself will be a *vector field*,

$$
\vec{F}(x,y,z,t) = F_x(x,y,z,t)\cdot \hat{x} + F_y(x,y,z,t)\cdot \hat{u} + F_z(x,y,z,t)\cdot \hat{z}
$$
58 changes: 58 additions & 0 deletions book/2_potential_fields/introduction/helmholtz_decomposition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Non-conservative Fields: Helmholtz Decomposition

In the previous section, we saw that a conservative vector field can be written as the gradient of a scalar field. Equations {eq}`eq:point-mass-gravitational-potential` and {eq}`eq:point-mass-gravity-field`, for example, describe the scalar potential of a point mass and the corresponding gravity vector field. Most of this chapter deals with fields of this type. We may nevertheless wonder whether physical vector fields always have this form. Anticipating that the answer is no, is there still a simple general expression for a vector field?

The answer is given by the **Helmholtz decomposition**. Under suitable smoothness and boundary conditions, a vector field can be written as

$$
\vec{F} = -\vec{\nabla}\Phi + \vec{\nabla}\times\vec{A}.
$$ (eq:helmholtz-decomposition)

The field is decomposed into two parts:

1. A conservative, or **irrotational**, part given by the gradient of a scalar potential. It is irrotational because

$$
\vec{\nabla}\times(-\vec{\nabla}\Phi)=\vec{0}.
$$

2. A divergence-free, or **solenoidal**, part given by the curl of a **vector potential**. It is solenoidal because

$$
\vec{\nabla}\cdot(\vec{\nabla}\times\vec{A})=0.
$$

The two parts have visibly different characters. Consider a cross-section through a uniform-density sphere and through a long wire carrying a uniform current. Inside the sphere, gravity points toward the centre and the field lines converge, but do not circulate. Inside the wire, the magnetic field circulates around the current, but its field lines neither begin nor end.

```{figure} figures/helmholtz_field_comparison.png
:name: helmholtz-field-comparison
:width: 100%

Two simple physical fields. Left: inside a uniform-density sphere, $\vec{g}=-\kappa(x,y,z)$ is irrotational and has negative divergence. Right: inside a long wire with uniform current in the $z$-direction, $\vec{B}=\beta(-y,x,0)$ is solenoidal and circulates around the current. The arrows show a two-dimensional cross-section; their colour and length indicate field magnitude.
```

Notice that *irrotational* does not mean that the field has no source, and *solenoidal* does not mean that the field cannot curve. The gravity field in the left panel has non-zero divergence within the mass distribution. The magnetic field in the right panel has non-zero curl, but zero divergence.

```{admonition} Exercise: from potentials to physical fields
:class: tip

Work in Cartesian coordinates.

1. Inside a sphere with uniform mass density $\rho$, postulate the gravitational potential per unit mass

$$
\Phi_g(x,y,z)=\frac{2\pi G\rho}{3}(x^2+y^2+z^2),
$$

where an arbitrary additive constant has been omitted. Calculate $\vec{g}=-\vec{\nabla}\Phi_g$. Then show that $\vec{\nabla}\times\vec{g}=\vec{0}$ and calculate $\vec{\nabla}\cdot\vec{g}$. How does the sign of the divergence relate to the converging arrows in the left panel?

2. Inside a long cylindrical wire carrying a uniform current density $\vec{J}=J\hat{z}$, postulate the vector potential

$$
\vec{A}(x,y,z)=-\frac{\mu_0J}{4}(x^2+y^2)\hat{z}.
$$

Calculate $\vec{B}=\vec{\nabla}\times\vec{A}$. Then show that $\vec{\nabla}\cdot\vec{B}=0$ and calculate $\vec{\nabla}\times\vec{B}$. How do these results relate to the circulating arrows in the right panel?
```

Later in the course we will use vector potentials to describe magnetic fields in more detail. For now, we will begin with the nicely irrotational gravity field.
1 change: 1 addition & 0 deletions book/2_potential_fields/introduction/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Introduction to Potential Fields
Loading