FourierFlows / GeophysicalFlows.jl

Geophysical fluid dynamics pseudospectral solvers with Julia and FourierFlows.jl.
https://fourierflows.github.io/GeophysicalFlowsDocumentation/stable/
MIT License
153 stars 31 forks source link

Option to specify topographic PV large-scale gradients in `MultiLayerQG` #313

Closed apaloczy closed 1 year ago

apaloczy commented 1 year ago

This closes #307 by adding options to specify a nonperiodic component of the topographic PV gradients (for example a planar slope) in the MultiLayerQG module. Also added one test.

The gradients of the nonperiodic part of the topographic PV are now specified separately via etax_nonperiodic and etay_nonperiodic in MultiLayerQG.Problem, and are added to the gradients of the periodic part of the topographic PV (calculated via FFTs).

navidcy commented 1 year ago

Sorry for slacking on this. I’m on holiday.

apaloczy commented 1 year ago

No worries at all! Take your time.

navidcy commented 1 year ago

@apaloczy, I think it's good to go! Have a look at the docstrings additions I made and modify if needed.

navidcy commented 1 year ago

I believe I gave you write rights so you can merge.

navidcy commented 1 year ago

@apaloczy, I'm wondering whether there is a requirement that etax_nonperiodic and etay_nonperiodic are themselves periodic! I think they should! Otherwise, e.g., the Qx term won't be periodic and then errors will be introduced via

https://github.com/apaloczy/GeophysicalFlows.jl/blob/f51365a4587fd483bb7231418e26b3ec6d81bc66/src/multilayerqg.jl#L774-776

right?

navidcy commented 1 year ago

Giving this more thought, I doubt the non-periodic topo PV would work with anything but constant slope η = a x + b y.

glwagner commented 1 year ago

The equations themselves have to be periodic; otherwise the discontinuity at domain "edges" will cause simulations to blow up.

navidcy commented 1 year ago

@apaloczy I suggest we change etax_nonperiodic to topographic_pv_x_slope and let that be a Float. Same for y. And clarify that users can prescribe large-scale topographic PV gradient in each direction.

What do you think?

navidcy commented 1 year ago

I had a go at it. Have a look. :)

apaloczy commented 1 year ago

Sorry for the slowness here. I was offline for a couple of days myself. This all sounds great, I think having the large-scale topographic PV slopes as floats makes sense.

It also makes sense that Qx and Qy have to be periodic otherwise boundary errors will appear, and a planar slope is the only non-periodic topographic PV possible since it gives a periodic, constant PV gradient.