Skip to content

OOPS 2D Tutorial: Polar Coordinates

Jacob Fields edited this page Jun 4, 2020 · 1 revision

Just as in analytical PDEs, not every problem is well-suited to Cartesian coordinates. There are a wide variety of interesting problems, such as gamma-ray bursts or various scattering problems, which may be easier and more natural to solve in polar coordinates. OOPS-2D has support for these problems, too.

Switching to Polar Coordinates

Switching to polar coordinates in OOPS-2D is easy and technically only needs one line of code. Consider the prototype for buildMesh:

Result Domain::buildMesh(unsigned int shp[2], Domain::GridCoordinates coord=Domain::CARTESIAN, bool periodic=false)

There are two extra arguments, coord and periodic, which are automatically set for Cartesian coordinates. To switch to polar coordinates, pass in Domain::POLAR instead. If you are modeling a complete circle, you can also set periodic to true to ensure that OOPS-2D automatically applies a periodic boundary condition at \theta = 0 and \theta = 2\pi.

Conventions

Concerning conventions, everything in OOPS-2D that was previously (x,y) in Cartesian coordinates becomes (r,\theta) in polar coordinates. As far as OOPS-2D is concerned, the Grid and Domain are still perfectly rectangular. Therefore, the LEFT and RIGHT boundary flags correspond to the minimum and maximum radius (the interior and exterior boundaries), and DOWN and UP correspond to the minimum and maximum angles (the most clockwise and most counterclockwise boundaries). The radial boundary must be nonnegative, and the angular boundaries must be in the range [0,2\pi].

Some Beginner Tips

Here are a few tips that may be helpful for newer users inexperienced with polar coordinates.

  1. Although processors containing the lower and upper bound of the angular coordinate will still have the DOWN and UP boundary flags set, these boundaries should be treated as ordinary points if periodic is set to true.
  2. The origin, r=0, is a coordinate singularity, and many derivative operators or equations will gain a factor of r^{-1} or r^{-2} in polar coordinates. These are relatively easy to handle analytically, but they are notoriously difficult for computers. Generally speaking, the most common solution is to excise the center and/or apply a special boundary condition to it instead, bringing us to the next point.
  3. As is the case in Cartesian coordinates, the quality of your boundary conditions will greatly affect the quality of your numerical solution. However, interior radial boundaries are often extremely difficult, particularly if they excise part of the physical domain or are not radially symmetric. It's well worth your time to make sure this boundary is a reasonable approximation to the physical solution.

Clone this wiki locally