This is the equation when the coordinates have the same reference length. If the coordinates are normalized with respect to different lengths, then the equation is as follows.
$$\frac{{\partial}^{2}P}{\partial {x}^{2}}+{\alpha}^{2}\frac{{\partial}^{2}P}{\partial {y}^{2}}=2{\alpha}^{2}\left[\frac{{\partial}^{2}\psi}{\partial {x}^{2}}\phantom{\rule{0.166667em}{0ex}}\phantom{\rule{0.166667em}{0ex}}\frac{{\partial}^{2}\psi}{\partial {y}^{2}}-{\left(\frac{{\partial}^{2}\psi}{\partial x\partial y}\right)}^{2}\right]$$
The Poisson equation for pressure needs to have boundary conditions for solution. The equations of motion give an expression for the pressure gradient. The normal derivative of pressure at the boundary can be determined for the Neumann-type boundary condition. The equations of motion usually simplify at boundaries if the boundary has no slip BC or if it has parallel flow in the direction either parallel or normal to the boundary. For example, for no-slip
$$\begin{array}{c}\frac{\partial P}{\partial x}=\frac{{\alpha}^{2}}{Re}\phantom{\rule{0.166667em}{0ex}}\frac{{\partial}^{2}u}{\partial {y}^{2}},\phantom{\rule{1.em}{0ex}}\mathrm{at}\phantom{\rule{0.277778em}{0ex}}y=c,\phantom{\rule{0.277778em}{0ex}}u=v=0\\ \alpha \frac{\partial P}{\partial y}=\frac{1}{Re}\phantom{\rule{0.166667em}{0ex}}\frac{{\partial}^{2}v}{\partial {x}^{2}},\phantom{\rule{1.em}{0ex}}\mathrm{at}\phantom{\rule{0.277778em}{0ex}}x=c,\phantom{\rule{0.277778em}{0ex}}u=v=0\end{array}$$
If the flow is parallel and in the direction normal to the boundary
$$\begin{array}{c}\frac{\partial P}{\partial x}=\frac{{\alpha}^{2}}{Re}\phantom{\rule{0.166667em}{0ex}}\frac{{\partial}^{2}u}{\partial {y}^{2}},\phantom{\rule{1.em}{0ex}}y=c,\phantom{\rule{0.277778em}{0ex}}v=0,\phantom{\rule{0.277778em}{0ex}}u=u\left(y\right)\\ \alpha \frac{\partial P}{\partial y}=\frac{1}{Re}\phantom{\rule{0.166667em}{0ex}}\frac{{\partial}^{2}v}{\partial {x}^{2}},\phantom{\rule{1.em}{0ex}}x=c,\phantom{\rule{0.277778em}{0ex}}u=0,\phantom{\rule{0.277778em}{0ex}}v=v\left(x\right)\end{array}$$
Cylindrical-polar coordinates
The code for the numerical solution of the Navier-Stokes equations in Cartesian coordinates can be easily modified to cylindrical-polar coordinates. The coordinate transformation is first illustrated for the Laplacian operator.
$${\nabla}^{2}\psi =\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial \psi}{\partial r}\right)+\frac{1}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {\theta}^{2}},\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}{r}_{1}\le r\le {r}_{2},\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{1.em}{0ex}}0\le \theta \le {\theta}_{o}$$
The independent variables are made dimensionless with respect to the boundary parameters.
$${r}^{*}=\frac{r}{{r}_{1}},\phantom{\rule{1.em}{0ex}}{\theta}^{*}=\frac{\theta}{{\theta}_{o}},\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}1\le {r}^{*}\le \frac{{r}_{2}}{{r}_{1}}=\beta ,\phantom{\rule{1.em}{0ex}}0\le {\theta}^{*}\le 1$$
The Lapacian operator with the dimensionless coordinates after dropping the * is now,
$${\nabla}^{2}\psi =\frac{1}{{r}_{1}^{2}}\left[\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial \psi}{\partial r}\right)+\frac{1}{{\theta}_{o}^{2}}\frac{1}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {\theta}^{2}}\right],\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}1\le r\le \beta ,\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{1.em}{0ex}}0\le \theta \le 1$$
The radial coordinate is transformed to the logarithm of the radius.
$$\begin{array}{c}z=\frac{lnr}{ln\beta}=\gamma lnr,\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}0\le z\le 1,\phantom{\rule{1.em}{0ex}}\gamma =\frac{1}{ln\left({r}_{2}/{r}_{1}\right)}\hfill \\ r=exp\left(z/\gamma \right)\hfill \\ \frac{\partial}{\partial r}=\frac{dz}{dr}\frac{\partial}{\partial z}=\frac{\gamma}{r}\frac{\partial}{\partial z}\hfill \\ \frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial \psi}{\partial r}\right)=\frac{{\gamma}^{2}}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {z}^{2}}\hfill \end{array}$$
The Laplacian operator is now as follows,
$${\nabla}^{2}\psi =\frac{1}{{r}_{1}^{2}}\left[\frac{{\gamma}^{2}}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {z}^{2}}+\frac{{\alpha}^{2}}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {\theta}^{2}}\right],\phantom{\rule{1.em}{0ex}}0\le z\le 1,\phantom{\rule{1.em}{0ex}}0\le \theta \le 1,\phantom{\rule{1.em}{0ex}}\alpha =\frac{1}{{\theta}_{o}}$$
The finite difference expression for the Laplacian will be same as that for Cartesian coordinates with
$(z,\theta )$ substituted for
$(x,y)$ except for
${\gamma}^{2}$ and
${r}^{2}$ factors.
$$\begin{array}{c}0\le {z}_{i}\le 1,\phantom{\rule{1.em}{0ex}}0\le {\theta}_{j}\le 1,\phantom{\rule{1.em}{0ex}}i,j=1,2,...,JMAX\hfill \\ \delta =\frac{1}{JMAX-1}\hfill \\ {z}_{i}=\delta \left(i-1\right),\phantom{\rule{1.em}{0ex}}{\theta}_{j}=\delta \left(j-1\right)\hfill \end{array}$$
The curl operator is modified from that in Cartesian coordinates.
$$\begin{array}{ccc}\hfill {v}_{r}& =& \frac{\alpha}{r}\frac{\partial \psi}{\partial \theta}\hfill \\ \hfill {v}_{\theta}& =& -\frac{\partial \psi}{\partial r}=-\frac{\gamma}{r}\frac{\partial \psi}{\partial z}\hfill \\ \hfill w& =& \frac{1}{r}\frac{\partial \left(r\phantom{\rule{0.277778em}{0ex}}{v}_{\theta}\right)}{\partial r}-\frac{\alpha}{r}\frac{\partial {v}_{r}}{\partial \theta}\hfill \\ & =& \frac{\gamma}{{r}^{2}}\frac{\partial \left(r\phantom{\rule{0.277778em}{0ex}}{v}_{\theta}\right)}{\partial z}-\frac{\alpha}{r}\frac{\partial {v}_{r}}{\partial \theta}\hfill \\ & =& -\frac{{\gamma}^{2}}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {z}^{2}}-\frac{{\alpha}^{2}}{{r}^{2}}\frac{{\partial}^{2}\psi}{\partial {\theta}^{2}}\hfill \end{array}$$
The vorticity boundary conditions with the transformed coordinates is for the
$z$ boundary,
$${w}_{1}^{BC}=-\frac{{\gamma}^{2}}{{r}^{2}}\frac{2}{{\delta}^{2}}\left({\psi}_{2}-{\psi}_{1}^{BC}\right)\mp \frac{\gamma}{r}\frac{2}{\delta}{v}_{\theta}^{BC}-\frac{\alpha}{r}\frac{\partial {v}_{r}^{BC}}{\partial \theta}$$
and for the
$\theta $ boundary,
$${w}_{1}^{BC}=-\frac{{\alpha}^{2}}{{r}^{2}}\frac{2}{{\delta}^{2}}\left({\psi}_{2}-{\psi}_{1}^{BC}\right)\pm \frac{\alpha}{r}\frac{2}{\delta}{v}_{r}^{BC}+\frac{\gamma}{{r}^{2}}\frac{\partial \left(r{v}_{\theta}^{BC}\right)}{\partial z}$$
The stream function at the boundaries are expressed different from that in Cartesian coordinates.
$$\begin{array}{c}d\psi =\left(r\phantom{\rule{0.277778em}{0ex}}{v}_{r}/\alpha \right)\phantom{\rule{0.166667em}{0ex}}d\theta ,\phantom{\rule{1.em}{0ex}}\mathrm{at}\phantom{\rule{0.277778em}{0ex}}z\phantom{\rule{0.277778em}{0ex}}\mathrm{boundary}\hfill \\ d\psi =-\left(r\phantom{\rule{0.277778em}{0ex}}{v}_{\theta}/\gamma \right)\phantom{\rule{0.166667em}{0ex}}dz,\phantom{\rule{1.em}{0ex}}\mathrm{at}\phantom{\rule{0.277778em}{0ex}}\theta \phantom{\rule{0.277778em}{0ex}}\mathrm{boundary}\hfill \end{array}$$
The convective terms are expressed different from that in Cartesian coordinates.
$$\begin{array}{ccc}\hfill \frac{\partial \left(u\phantom{\rule{0.166667em}{0ex}}w\right)}{\partial x}& \Rightarrow & \frac{1}{r}\frac{\partial \left(r\phantom{\rule{0.166667em}{0ex}}u\phantom{\rule{0.166667em}{0ex}}w\right)}{\partial r}\hfill \\ & =& \frac{\gamma}{{r}^{2}}\frac{\partial \left(r\phantom{\rule{0.166667em}{0ex}}u\phantom{\rule{0.166667em}{0ex}}w\right)}{\partial z}\hfill \\ & \approx & \frac{\gamma}{{r}^{2}\phantom{\rule{0.166667em}{0ex}}\delta}\left[{\left(r\phantom{\rule{0.166667em}{0ex}}u\phantom{\rule{0.166667em}{0ex}}w\right)}_{i+1/2}-{\left(r\phantom{\rule{0.166667em}{0ex}}u\phantom{\rule{0.166667em}{0ex}}w\right)}_{i-1/2}\right]\hfill \\ \hfill \alpha \frac{\partial \left(v\phantom{\rule{0.166667em}{0ex}}w\right)}{\partial y}& \Rightarrow & \frac{\alpha}{r}\frac{\partial \left(v\phantom{\rule{0.166667em}{0ex}}w\right)}{\partial \theta}\hfill \\ & \approx & \frac{\alpha}{r\phantom{\rule{0.166667em}{0ex}}\delta}\left[{\left(v\phantom{\rule{0.166667em}{0ex}}w\right)}_{j+1/2}-{\left(v\phantom{\rule{0.166667em}{0ex}}w\right)}_{j-1/2}\right]\hfill \end{array}$$
The code should be written so one can have either Cartesian coordinates or transformed cylindrical-polar coordinates. A parameter will be needed to identify the choice of coordinates, e.g.
$icase=1$ for Cartesian coordinates and
$icase=2$ for transformed cylindrical-polar coordinates. Also, another parameter should be specified to identify the choice of boundary conditions, e.g.,
$ibc=1$ for radial flow,
$ibc=2$ for Couette flow, and
$ibc=3$ for flow around a cylinder.
Test cases with known solutions should be used to verify the code. The first case is radial, potential flow from a line source and the second is Couette flow in the annular region between two cylindrical surfaces.
$$\begin{array}{c}\left(\begin{array}{c}{v}_{r}=1/r\\ {v}_{\theta}=0\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\end{array}\right\}\phantom{\rule{1.em}{0ex}}\mathrm{radial}\phantom{\rule{0.277778em}{0ex}}\mathrm{flow}\hfill \\ \left(\begin{array}{c}{v}_{r}=0\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\phantom{\rule{1.em}{0ex}}\\ {v}_{\theta}=\left(r-1/r\right)/\left(\beta -1/\beta \right)\end{array}\right\}\phantom{\rule{1.em}{0ex}}\mathrm{Couette}\phantom{\rule{0.277778em}{0ex}}\mathrm{flow}\hfill \end{array}$$
Flow around a cylinder needs a boundary condition for the flow far away from the cylinder. The flow very far away may be uniform translation. However, this condition may be so far away that it may result in loss of resolution near the cylinder. Another boundary condition that may be specified beyond the region of influence of the boundary layer is to use the potential flow past a cylinder. This boundary condition will not be correct in the wake of cylinder where the flow is disturbed by the convected boundary layer buts its influence may be minimized if the outer boundary is far enough.
$$\left(\begin{array}{c}{v}_{r}=\left(1-1/{r}^{2}\right)\phantom{\rule{0.166667em}{0ex}}\phantom{\rule{0.277778em}{0ex}}cos\theta \\ {v}_{\theta}=-\left(1+1/{r}^{2}\right)\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}sin\theta \phantom{\rule{0.277778em}{0ex}}\end{array}\right\}\phantom{\rule{1.em}{0ex}}\mathrm{Potential}\phantom{\rule{0.277778em}{0ex}}\mathrm{flow}\phantom{\rule{0.277778em}{0ex}}\mathrm{past}\phantom{\rule{0.277778em}{0ex}}\mathrm{cylinder}$$
Potential flow will not be a valid approximation along the
$\theta $ boundaries close to the cylinder. Here, one may assume a surface of symmetry, at least for the upstream side.