Stokes' theorem and non-globally defined quantities

This is a question from a physicist, so please be kind.* Suppose that $M$ is an orientable smooth manifold without boundaries and $\omega$ a form of an appropriate degree such that it can be integrated over $M$, $$I=\int_M \omega.$$ The objective is to compute $I$. According to the Poincaré or Dolbeault-Grothendieck lemma (for real and complex manifolds respectively), locally (in some coordinate neighbourhood, $U_i$, where $M$ looks like an open subset of $\mathbb{R}^n$ or $\mathbb{C}^n$, with $n$ a positive integer, and because i don’t want to restrict the scope i will write $\mathbb{K}$ for either of the two fields) $\omega$ is exact, $$\omega_i=dA_i,$$ where $A_i$ is some differential form defined in $U_i$ of the appropriate degree. If $A_i$ were globally defined (in which case I suppose, $A_i=A$, for all $i$) then we could apply Stokes' theorem, $$\int_MdA = \oint_{\partial M}A=0,$$ and learn that $I=0$ (because $\partial M$ is null). I am in the unfortunate (and I believe very common) situation where I only know $\omega$ locally (in particular I have an explicit expression for $A_i$) and I want to compute $I$. So my first question is the following:

1. What precisely does it mean for $A_i$ to be only locally and not globally defined? How can I check whether my $\omega_i$ is globally or only locally exact given only an explicit local expression for $A_i$ and the corresponding transition functions on chart overlaps? For instance, might it be true that in order for $A_i$ to be globally defined it must transform under changes of coordinates as an antisymmetric tensor (on chart overlaps, $U_i\cap U_j$), and might this be sufficient for $A_i$ to be globally defined?

Suppose now that I am in the fortunate situation where I know the answer to this question, and I have concluded that $A_i$ is not globally defined and hence that $\omega$ is not globally exact. The next question is:

1. How can I explicitly reconstruct $I$ given the explicit local expression $\omega_i=dA_i$ on $U_i$ and the corresponding transition functions on patch overlaps $U_i\cap U_j$?

To be slightly more precise here I am implicitly considering an atlas for $M$, i.e. a family of charts, $\{(U_i,\phi_i)\}$, with $\{U_i\}$ a family of open sets such that $\cup_i U_i=M$, and $\phi_i:U_i\rightarrow \mathbb{K }$ a homeomorphism from $U_i$ to an open subset of $\mathbb{K}$ (in particular, the maps $\phi_i$ are to be considered known and identified with a convenient set of local coordinates). The case of interest is when the transition functions $f_{ij}=\phi_i\circ \phi_j^{-1}$ from $\phi_j(U_i\cap U_j)$ to $\phi_i(U_i\cap U_j)$ are $C^{\infty}$ and also known.

For question 2 Stokes' theorem comes to the rescue, given that in a patch $U_i$, $$\int_{U_i}dA_i = \oint_{\partial U_i}A_i,$$ but how exactly does one sum over $i$ to reconstruct the full integral $I$ making use of the transition functions which map $A_j$ to $A_i$ on patch overlaps?

*I have rewritten the question completely because following a fairly extensive discussion with @John Hughes (whom I think I annoyed quite a bit, see below) and his correspondingly good comments, it became very clear that my intended question was not clearly formulated.

I'm not certain what you mean here. It's certainly true that if $M$ is, say, $S^1$, then there's a 1-form whose integral over $M$ is nonzero. You'll often see, for instance, $$\int_{S^1} ~d\theta = 2\pi$$
Sadly, that's a cruel joke, because "$d\theta$" is the name given to a particular 1-form that is not, in fact, "d" of any $0$-form. Explicitly, $$d\theta (x, y) = \frac{-y}{x^2 + y^2} dx + \frac{x}{x^2 + y^2} dy$$ on $\Bbb R^2 - \{ (0,0) \}$ and the form we call $d\theta$ on $S^1$ is the restriction of this to the subset of all points $(x, y)$ with $x^2 + y^2 = 1$.
This may not be the enlightenment you were looking for, but your first main point "There are situations where the integral of the total derivative does not vanish" just seems wrong to me (because of Stokes' theorem!). (I'm assuming here that we're talking about forms $A$ and $dA$ that are everywhere defined on a compact manifold $M$, possibly with boundary.)
• The statement "There are situations where the integral of the total derivative does not vanish" is correct: consider the integral $I = \int_{M_g}d(\bar{\omega}\int^z\omega)$, where $\omega$ (or $\bar{\omega}$) is one of the $g$ globally defined (anti-)holomorphic differential 1-forms (whose existence is guaranteed by a famous index theorem) on a compact genus $g$ Riemann surface $M_g$. So $I$ is an integral of a total derivative. One can show that $I = -2i{\rm Im}\Omega$, and so is not zero. This is an example, but my question and interest above is much broader than this. – Wakabaloola Mar 13 '18 at 12:46
• Perhaps you could explicitly write out what those 1-forms are for $g = 1$, where we're talking about a torus, which we can parameterize via $\theta$ and $\phi$. I'm wondering whether it'll turn out that your $\omega$ is just $d\theta$ in disguise. Frankly, I don't understand your notation, so I can't say whether what you've written is right or wrong. I encourage you to get explicit and write down what you're talking about in coordinates in a nice simple case like the torus, and possibly enlighten us both. – John Hughes Mar 13 '18 at 12:51
• Certainly: for $g=1$, $\omega=dz$, $\bar{\omega}=d\bar{z}$, $d=dz\partial_z+d\bar{z}\partial_{\bar{z}}$, where $z,\bar{z}$ are global (anti-)holomorphic coordinates with identifications $z\sim z+1$ and $z\sim z+\tau$, where $\tau\in \mathbb{C}$ (with ${\rm Im} \tau>0$) characterises the complex structure of the torus. Then, $I=\int_{T^2}d(zd\bar{z})$ and $zd\bar{z}$ is a 1-form. So this trivial example reduces to $I=\int_{T^2}dz\wedge d\bar{z}=-2i{\rm Im}\tau$. The genus-$g$ generalisation follows from the Riemann bilinear identity. – Wakabaloola Mar 13 '18 at 13:09
• Excellent. This shows that there's a 2-form $\omega$ whose integral is nonzero. [In real coordinates $z = x + iy$, it appears that $dz \wedge d\bar{z}$ is something like $C~ dx \wedge dy$ for some constant $C$.] Can you tell me a 1-form $\eta$ such that $\omega = d\eta$? Because what you claimed was that there was a 2-form that was a total derivative, and whose integral does not vanish. (It'd be great if you could tell me in real coords, because I'm much weaker on complex stuff (grad school was a long time ago!), but ...) – John Hughes Mar 13 '18 at 13:25
• Yes, in real coordinates, $\eta = (x+iy)dx+(y-ix)dy$, $d=dx\partial_x+dy\partial_y$, and so $\omega = d\eta=-2i dx\wedge dy$. – Wakabaloola Mar 13 '18 at 13:42