zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.
https://py-pde.readthedocs.io
MIT License
402 stars 51 forks source link

How to solve this set of PDE in GFD? #431

Closed miniufo closed 1 year ago

miniufo commented 1 year ago

Hi, I am recently working on a PDE solver for geophysical fluid dynamic problems and it is really great to come across this excellent package!

Just two quick questions here:

  1. Is it possible to use this solver in an arbitary domain like the ocean with arbitary shape of coastlines?
  2. I have a problem in hand which is a set of PDEs with two unkown: streamfunction $\psi$ and layer thickness $h$:

$$ \begin{align} \nabla \cdot\left(h^{-1}\nabla \psi\right)+f&=c_0 h \psi + c_1 h \tag{1}\ g\nabla h &= \frac{f}{h}\nabla\psi \tag{2} \end{align} $$

where $f$ is a known function of $y$, and $g$, $c_0$, $c_1$ are all constants. Is it possible to solve this PDE set using py-pde, with proper boundary conditions?

david-zwicker commented 1 year ago

Unfortunately, I don't think py-pde is the right package to solve these equations. Since it is based on finite-differences, it cannot cope with arbitrary boundary conditions easily. I recommend looking into finite element or finite volume methods.