miniufo / xinvert

Invert geophysical fluid dynamic problems (elliptic partial differential equations) using SOR iteration method.
https://xinvert.readthedocs.io/
MIT License
40 stars 15 forks source link

Pressure perturbation equation #35

Open ealucy opened 5 months ago

ealucy commented 5 months ago

Hello, I'm working with the dynamic pressure perturbation equation (Laplacian of p = -roh*((dudx)2+(dvdy)2+(dwdz)**2)). At small scales, what boundary conditions, mxLoop, and tolerance would you reccomend?

miniufo commented 5 months ago

Hi, you can use latex here. So the equation looks like:

\nabla^2 p = - \rho \left[\left(\frac{\partial u}{\partial x}\right)^2 + \left(\frac{\partial v}{\partial y}\right)^2 + \left(\frac{\partial w}{\partial z}\right)^2\right]

For mxLoop and tolerance, both determine the end of iteration. So larger mxLoop or smaller tolerance will give you a more converged result (this case is certainly convergent). You could practice with different parameters to see if the final results change a lot or not. If the difference is invisible, then it could be very close to the solution. For extreme case, you could use mxLoop=1 and compare the result with mxLoop=10, you will see very large difference.

For boundary conditions (BCs), it is a bit complex.

Just remember that the solution has two parts: one induced by BCs, and the other induced by forcings on the r.h.s. The one induced by BCs could be understood as that induced by forcings outside the region.

ealucy commented 4 weeks ago

So mxLoop=1 is an extreme and likely not producing a converged result?

miniufo commented 4 weeks ago

mxLoop=1 means you only iterate one time and then break the loop of iteration. If the equation is exactly Poisson-type, it should converge.