Magnetic flux through circular loop due to infinite wire I’m trying to calculate magnetic flux that’s going through circular loop with radius $R$, due to magnetic field of a infinite wire that is in distance $d$ from the center of the loop. $\vec{B}$ vector is parallel to $\vec{dS}$ vector. I know that magnetic field of that wire is equal to $B=\frac{\mu_0 I}{2\pi r}$ and that flux is equal to $$\int_{S} \vec{B}\cdot \vec{dS}=\int_{S} B\cdot dS$$ where $dS$ Is surface of the loop, but what I don’t know is how to change that $dS$ so is possible to solve.

 A: 
The convenient infinitesimal surface $\rm dS$ is shown in the Figure-01 :
\begin{equation}
\mathrm{dS} \boldsymbol{=}\mathrm{hdw}\boldsymbol{=} (2R\sin\theta)( \mathrm d\ell\sin\theta)\boldsymbol{=} (2R\sin\theta)( R\mathrm d\theta\sin\theta) 
\tag{01}\label{01} 
\end{equation}
so
\begin{equation}
\mathrm{dS} \boldsymbol{=}2R^2\sin^2\theta\mathrm d\theta\boldsymbol{=}R^2(1\boldsymbol{-}\cos2\theta)\mathrm d\theta
\tag{02}\label{02} 
\end{equation}
We could verify that
\begin{equation}
\int\limits_{\theta\boldsymbol{=}0}^{\theta\boldsymbol{=}\pi}\!\!\!\!\mathrm{dS}=\pi R^2
\tag{03}\label{03} 
\end{equation}
Hence for the magnetic flux through the circle we have
\begin{equation}
\Phi=\int\!\!\!\int\limits_{\!\!\!\!\!\!\bf circle}\!\!\mathbf{B}\boldsymbol{\cdot}\mathrm{d}\mathbf{S}=\int\!\!\!\int\limits_{\!\!\!\!\!\!\bf circle}\!\!\mathrm{B}\,\mathrm{dS}=\dfrac{\mu_{0}\mathrm{I}R^2}{\pi }\int\limits_{\theta\boldsymbol{=}0}^{\theta\boldsymbol{=}\pi}\!\!\!\!\dfrac{\sin^2\theta\,\rm d\theta}{\mathrm{ L}-R\cos\theta}
\tag{04}\label{04} 
\end{equation}
In Figure-02 below we see a detail of Figure-01  corresponding to this comment of OP :

Why $\rm dw=\sin\theta d\ell$ ? – cover


A: 
fig 1: The geometry of the calculation. Note that the distance of the wire from the center has been taken to be $D$, not $d$.
Let the magnitude of the magnetic field due to an infinite constant current carrying straight wire at a distance $r$ from it be $k/r$.
In the given geometry, the wire is co-planar with the loop. This makes the problem effectively $2$ dimensional. Taking the interior of the circle (in its embedding plane) as the surface of integration of flux calculation, the magnetic field is everywhere (anti)parallel to the surface normal vector, as noted in the question.
Since the magnetic field is only dependent on the distance from the wire, it is constant in the small differential patch of area $2\,y\, dx$, colored gray in fig $1$.  The magnitude of the total flux is then given by
$$
\begin{align}
I&=\int_{-R}^{R}\frac{k \,2 y dx}{r}&\\
&=2 k\int_{-R}^{R}\frac{\sqrt{R^2-x^2}dx}{D-x}\tag{1}\\
\end{align}
$$
which equals$^{A.1}$
$$
I=
\begin{cases}
2\pi k (D-\sqrt{D^2-R^2})& D>R\tag{2}\\
\phantom{}\\
2\pi k D & D\leq R\\
\end{cases}
$$

Appendix

*

*The integral in the RHS of equation $1$ is (via Mathematica)
$$
-y+D\tan^{-1}\frac{x}{y}-\sqrt{D^2-R^2}\tan^{-1}\left(\frac{D x -R^2}{y\sqrt{D^2-R^2}}\right)
$$
where $y=\sqrt{R^2-x^2}$ with limits $(x,y)$ going from $(-R,0)$ to $(R,0)$. One has to be careful with the limits here. While the third term is imaginary for $D<R$, it cancels out for the limits.


*First case of Eqn. $2$ has the expected asymptotic form, $ k \pi R^2/D$, for $D\to\infty$. Interestingly, if one considers only its real part, it holds for $R\to\infty$ too.


*The second case of Eqn. $2$ viz. the case of the wire being inside the loop, is remarkably independent of $R$ and depends linearly on $D$. This was indeed verified numerically$(1\sigma)$.

fig 2: Monte-carlo verification of eqn. 2  for $R=1,2\,\,(k=1)$
