Could I use Green's Theorem here?

85 Views Asked by At

I want to solve for the line integral:

$$\tag{1}\oint \alpha\nabla \phi_i\cdot \hat{\textbf{n}} ds$$

on the square boundary: $(0\le x \le 1, 0), (1,0 \le y \le 1), (1 \le x \le 0, 1),(0,1\le y \le 0)$

Where the function $\phi_i = \sin(n\pi x)\sin(n\pi y)$ and $\alpha = 1$ on the boundary. I don't know how $\hat{\textbf{n}}$ is oriented with respect to the gradient of $\phi_i$, so would it be possible to instead use Green's theorem $\oint_C Pdx + Qdy = \int\int_D \Big(\frac{\partial Q}{\partial x} -\frac{\partial P}{\partial y}\Big) dA$ and compute the double integral instead?

2

There are 2 best solutions below

3
On BEST ANSWER

The gradient of $$ \phi(x,y) = \sin(n\pi x)\sin(n\pi y) $$ is $$ \nabla\phi=n\pi\pmatrix{\cos(n\pi x)\sin(n\pi y)\\\sin(n\pi x)\cos(n\pi y)}\,. $$ The divergence of that gradient is $$ \Delta\phi(x,y)=-2\,n^2\pi^2\sin(n\pi x)\sin(n\pi y)\,. $$ By Gauss' and Green's theorem \begin{align} \oint_{\partial\,Q}\nabla\phi\cdot\hat{\mathbf{n}}\,ds =\int_Q\Delta\phi\,dA \end{align} where $Q$ is your square and $\hat{\mathbf{n}}$ the outward pointing unit normal at the boundary.

It should be very easy to calculate the $dA$ integral over the square. If it is zero or not depends on whether $n$ is odd or even.

Since the function $\alpha$ is one on the boundary it has no influence on these results.

4
On

So going off of Kurt G, for $\alpha = 1$ on the boundaries, I should get:

$$\oint_C 1\nabla \phi_i \cdot \hat{\textbf{n}} ds = \int\int_D \nabla \cdot \nabla\phi_i dA$$

And computing the double integral, I should get:

$$-2(n\pi)^2\int_0^1 \int_0^1 \sin(n\pi x)\sin(n \pi y)dxdy = \\ 2n\pi \int_0^1 \Big(\cos(n\pi x)|_0^1\Big)\sin(n\pi y)dy = \\ 2n\pi \Big((-1)^n -1\Big)\int_0^1 \sin(n\pi y)dy = \\ -2\Big((-1)^n -1\Big)\Big(\cos(n\pi y)|_0^1\Big) = \\ \boxed{-2\Big((-1)^n -1\Big)^2}$$

Is that correct?


EDIT:

Plugging this result into $$b_i = \int\int f(x,y) \phi(x,y)_i dA +\oint \alpha \nabla \phi_i \cdot \hat{\textbf{n}}ds$$ to obtain the solution $$u(x,y) = \sum_i b_i\phi_i$$, yielded a solution about 99.3% accurate compared to the desired solution within the domain. This can be seen by comparing the 2 plots below.

enter image description here

The problem with the plot on the left which I intentionally excluded the values of the solution on the boundary, also evaluated to 0 meaning this solution for whatever reason maintained its homogeneity when it was supposed to be inhomogeneous with the values of the solution being 1. Not sure why this happened.