Nonuniform finite difference grid for a PDE where the x points depends on y coordinate

I'm currently working on a solution of a second-order nonlinear PDE adopting a finite difference approximation. For this, I'm using 5 and 9-point stencils in order to approximate the partial derivatives. The problem is that the domain on which the function is being approximated is nonuniform, more precisely the $x$ domain is a function of $y$ for each $y$ row, given by $x_{0}/\cos y$, where $x_{0}$ is the $x$ domain for $y=0$. An example of a grid with what I'm saying is given in the image below:

enter image description here

So, as expected, the FDM approximation is a bit complex to compute, since each point will have different $\Delta x$ compared to the adjacent lines. Furthermore, $\Delta y$ is constant.

I've been taking a look at nonuniform grids, where the solution can be obtained by mapping the grid to a new computation coordinate system where the grid is uniform, but the applications that I've found are very shallow, adopting, for instance, a power rule to refine the grid at some point. Is it possible to work with something similar for my problem? If any reference on this could be provided it will be very appreciated. Thank you in advance.


Your $(x,y)$ domain can be seen as the image of a rectangle through the transformation $$ \begin{cases}x = & \dfrac{u}{\cos v} \\[1em] y = & v \end{cases} $$

If you construct a uniform grid of the rectangle $R=[0.5,1]\times[0,0.8]$ and compute its image using this transformation, you get your current domain.

So, basically, you need to rewrite your equation in terms of the variables $(u,v) = (x \cos y, y)$ and solve it in$R$. This just involves using the chain rule. For instance,

$$ \frac{\partial f}{\partial x} = \frac{\partial f}{\partial u} \frac{\partial u}{\partial x}+\frac{\partial f}{\partial v} \frac{\partial v}{\partial x} = \frac{\partial f}{\partial u}\cdot \cos y = \frac{\partial f}{\partial u} \cdot \cos v $$

$$ \frac{\partial f}{\partial y} = \frac{\partial f}{\partial u} \frac{\partial u}{\partial y}+\frac{\partial f}{\partial v} \frac{\partial v}{\partial y} = -x \sin y \cdot \frac{\partial f}{\partial u} + \frac{\partial f}{\partial v }=-u \tan v \cdot \frac{\partial f}{\partial u}+ \frac{\partial f}{\partial v } $$