If $D$ is a Weil divisor, how do I get the invertible sheaf $\mathcal{O}_S(D)$? In Beauville's Complex Algebraic Surfaces, chapter $1$, the author takes a smooth variety $S$ (over $\Bbb{C}$) and mentions the correspondence between Weil divisors modulo linear equivalence and invertible sheaves modulo isomorphisms:
$$D\mapsto \mathcal{O}_S(D)$$
I know that a Cartier divisor $D=\{(U_i,f_i)\}\in\text{CaDiv}(S)$ provides an invertible sheaf defined simply by:
$$\mathcal{O}_S(D)\big|_{U_i}:=\frac{1}{f_i}\mathcal{O}_S\big|_{U_i}$$
Which is how we define a map $\text{CaCl}(S)\to\text{Pic}(S)$.
I've already found in different authors an explicit isomorphism $\text{WCl}(S)\to\text{CaCl}(S)$, so technically I'm able do describe $D\mapsto \mathcal{O}_S(D)$ by the composition $\text{WCl}(S)\to\text{CaCl}(S)\to\text{Pic}(S)$.
However, the construction of $\text{WCl}(S)\to\text{CaCl}(S)$ uses a (somewhat) subtle argument involving local rings in order to find the functions $f_i$ and, all things considered, it takes at least a paragraph to explain the composition above honestly.
On the other hand, the way Beauville mentions the map $D\mapsto\mathcal{O}_S(D)$ makes it seem natural, so I wonder if there's a simpler description of it.
 A: Let $X$ be a Noetherian, integral separated scheme, regular in codimension $1,$ and let $K(X)$ be its function field. If you want to weaken these hypotheses, you can -- but you will need to carefully replace $K(X)$ by the sheaf of rational functions $\mathcal{K}_X$ on $X.$
Suppose that $D = \sum_{Y} n_Y[Y]$ is a Weil divisor on $X.$ We may define the line bundle $\mathcal{O}_X(D)$ explicitly to be the set of invertible rational functions $f$ on $X$ (i.e., elements of $K(X)^\times$) such that $f$ has zeros and poles prescribed by the divisor $D$ in the following sense:
$$
\mathcal{O}_X(D) := \{f\in K(X)^\times\mid (f) + D\geq 0\}.
$$
Here, $(f)$ is the divisor associated to $f$:
$$
(f) := \sum_{Y}\nu_Y(f)[Y],
$$
where $\nu_Y : \mathcal{O}_{X,\eta}\to\Bbb{Z}$ is the valuation on the DVR $\mathcal{O}_{X,\eta},$ the stalk of $\mathcal{O}_X$ at the generic point of $Y.$ Recall that we say that $f$ has a zero along $Y$ of order $\nu_Y(f)$ if $\nu_Y(f)>0,$ and that $f$ has a pole along $Y$ of order $-\nu_Y(f)$ if $\nu_Y(f) < 0.$
So, $\mathcal{O}_X(D)$ consists of rational functions on $X$ such that $\nu_Y(f)\geq -n_Y$ for all $Y.$ That is to say, if $n_Y < 0,$ then $f$ must have a zero along $Y$ of order at least $-n_Y,$ and if $n_Y > 0,$ $f$ is allowed to have a pole along $Y$ of order at most $n_Y.$
Ravi Vakil discusses this construction in more generality and provides examples here.
