OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
245 stars 120 forks source link

Strange un-physical behaviour in Leeway model #566

Closed ondave closed 1 year ago

ondave commented 3 years ago

There is a problem with the model treatment of the pre-defined drifting settings for floating objects. In an oscillating wind, a cluster of elements will expand and then contact again. While this is artefact of the random (but constant) component of the wind slope in the equations, this is clearly un-phyiscal in the that an area of probability will not contract with time with some kind of convergent forcing field.

We have seen this with real winds for a real world SAR simulation. However for clarity, the code below reproduces the effect in simplest way possible.

from datetime import datetime
import numpy as np
from opendrift.models.leeway import Leeway
from opendrift.readers.reader_oscillating import Reader as OscillatingReader
from opendrift.readers.reader_constant import Reader as ConstantReader

wind_reader=OscillatingReader('x_wind', 2, period_seconds=3600 * 6, phase=0, zero_time=datetime(2020,1,1))

model=Leeway()
model.seed_elements(
    lon=0.0, 
    lat=0.0, 
    time=datetime(2020,1,1,0,0,0), 
    object_type=1,
    number=1000
)
model.add_reader([wind_reader])
model.set_config('environment:constant:y_wind',0.)
model.set_config('environment:constant:x_sea_water_velocity',0.)
model.set_config('environment:constant:y_sea_water_velocity',0.)
model.set_config('environment:constant:land_binary_mask',0.)
model.set_config('general:use_auto_landmask',False)

model.run(end_time=datetime(2020,1,2),time_step=3600)

model.animation()

There are also some concerns with certain object classes with negative constant offsets for wind drift, which may then sail upwind in very light wind conditions, again an artefact of equations, but un-physical and confusing.

Hope this is a constructive bug report, and thanks to the development team for a very useful library.

knutfrode commented 3 years ago

Hi,

At first this seems like a bug, but at second thought, I believe that this is instead a "feature". In the meantime I also asked Arthur Allen (the originator of the Leeway model), who agrees with this. As the drift coefficients stay constant for each element, it is in fact expected that particles should have this behaviour in the (unrealistic) case of no current and a wind field oscillating in just one direction.

In real cases (including real modeling cases), there will be a natural spread (growth of entropy) mainly due to time-varying fields of currents and winds. Jibing will also contribute, but not very much. In addition, it makes sense to add some diffusivity (random walk perturbations) to the current and/or wind fields. For the Leeway implementation in OpenDrift, the diffusivity is 0 by default. But this may be adjusted by the user with:

o.set_config('drift:horizontal_diffusivity', 10)  # m2/s

Which value to use for the diffusivity is however an open question, but the range 1-10 seems to give "reasonable" spread. This example uses a diffusivity of 10 m2/s: https://opendrift.github.io/gallery/example_horizontal_diffusion.html

knutfrode commented 3 years ago

Regarding your second point about negative coefficients giving upwind drift, this is also discussed here: https://github.com/OpenDrift/opendrift/issues/87 In Leeway there is a separation between "constrained coefficients" which are forced through 0 to prevent unphysical behaviour, and raw, "unconstrained coefficients". Arthur Allen actually recommends using unconstained coefficients (like in the case you observe), as the constrained coefficients seem to give over-prediction at higher winds. I admit this is not fully clear to me, but I trust his experience and judgement on this.

ondave commented 3 years ago

OK, thanks for reply and a useful discussion.

You are probably right that in the majority of cases, there will typically be a growth of the element cluster. However we have observed the effect I described with real winds during a sea breeze reversal and low current regime. So just be aware that a naive application of the model to SAR operations could lead to behaviour that would be confusing and counter-intuitive to an operator. However, I don't think OpenDrift is intended as a plug and play operational software package; so it is up to researchers and developers to understand (and if necessary modify) the physical schemes.

Regarding diffusion coefficients, my understanding these should really be set appropriate to the sub-grid scale of the forcing fields being used. So (for example) a higher resolution model implies using lower coefficients, as some turbulent dynamics should be included in model flow fields. Again, this requires understanding of the physical environment and the driving models.