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

boundary conditions #1

Open miniufo opened 2 years ago

miniufo commented 2 years ago

Currently, the boundary conditions are specified as:

sf = invert_Poisson(vor, dims=['lat', 'lon'], BCs=['fixed', 'periodic'])

which means the north-south BCs are all fixed and east-west BCs are periodic. This is not flexible enough if one wants the north BC as the 'fixed' one while the south BC as the 'extend' or 'reflect' one.

One possible solution is to use dict to specify BCs as:

sf = invert_Poisson(vor, dims=['lat', 'lon'], BCs={'lat':('fixed'. 'extend'), 'lon':('periodic', 'periodic')})

Also, I am thinking if the underlying algorithm should be refactored as two steps: 1) pad the domain with proper BCs and 2) iterate for the solution. But this may cause some problems if BCs are at 1) poles and 2) vortex center where coordinates are undefined.