OpenDrift / opendrift

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

Foreward versus backward run #1428

Closed amandineschaeffer closed 3 weeks ago

amandineschaeffer commented 1 month ago

Hi, Are forward and backward runs supposed to be equivalent? I have tried the following: run backward, then get the last lat / lon positions (using o3.history['lat'], and o3.history['lon']) and time and run forward. There are a few differences in the 2 runs, very small but it's only a 3 day run. Is it expected, why (numerical errors)? Or am I doing something wrong? Thanks for your input, and a great open source tool! Amandine

Backward

o3.seed_elements(lon=151.3, lat=-33.94, number=1, time=datetime(2022, 10, 6, 0, 0)) o3.run(time_step=-3600, time_step_output=3600, duration=timedelta(days=3))

Forward

o4.seed_elements(lon=151.59078979492188, lat=-33.49517822265625, number=1, time=datetime(2022, 10, 3, 0, 0)) o4.run(time_step=3600, time_step_output=3600, duration=timedelta(days=3))

knutfrode commented 1 month ago

Hi,

Yes, some numerical difference would be expected in any case, but these would be smaller with smaller calculation timestep. Her is an illustration: https://opendrift.github.io/gallery/example_backandforth.html

But if you have irreversible processes, such as diffusion, you would get larger differences.

amandineschaeffer commented 1 month ago

Hi, Thank you for your answer and for pointing towards the backandforth example. That makes a lot of sense. Regards, Amandine

knutfrode commented 3 weeks ago

Closing, please re-open if further questions regarding this.