Surface Passive tracers issue when apply extenison then compression?
Hi all, so i had an issue when I assign passive tracers to surface coordinates so to use it in the surface processes. So the original function of passive tracers and surface processes works fine when you start your 2D model in extension or compression from begining but when you apply extension followed by compression it failed or give weird patterns (attached) like passive tracer outside local cell / swarm escaped / particle out of domain / cannot locate particle????
before fix
I see odd particle distributions at the surface - that looks problematic.
Some questions to better understand what's happening: What version of the code are you running? Does the model work without surface processes enabled? Does it work without the passive tracers included?
Hi Julian, so this is UW2.15.0 but I though it is not related to the verison? since i think when you define the passive tracers on the surface but then you extend and then you again compress they got confused? Yes the model works fine without surface processes. Yes it works perfeclty fine without any passive tracers. Also it works fine if passive tracers and surface processes are enables but only you apply extension or compression. It only gives this weird shape when you apply extension, then you apply compression
I had a look at this with the help of Claude and this is what I got:
The spikes are produced in the solve method of velocitySurface_2D (UWGeodynamics/surfaceProcesses.py). After tracers are advected horizontally:
# surfaceProcesses.py — velocitySurface_2D.solve
x_new = surface_data[:,0] + (surface_data[:,2] * dt)
y_new = surface_data[:,1] + (surface_data[:,3] * dt)
the x-coordinates in x_new are no longer uniformly spaced — tracers cluster in zones of convergence and spread apart in extension zones. The current code fits a cubic spline through these non-uniform points:
f = interp1d(x_new, y_new, kind='cubic', fill_value='extrapolate')
Cubic interpolation on non-uniformly spaced data is susceptible to Runge-like oscillations, which appear as spurious topographic spikes in the output.
Proposed fix
Change line 1134 in velocitySurface_2D.solve to use kind='linear':
f = interp1d(x_new, y_new, kind='linear', fill_value='extrapolate')
This eliminates the overshoot on non-uniform point distributions. The final interpolation a few lines later should remain cubic, because it maps the result back onto nd_coords[:,0], which is the original uniformly-spaced grid.
Before the proposed fix:
After the proposed fix:
so when i tried that on low resolution model like 1.25km reoslution so after rifting and when i started cooling so I set velcoity BC to zero it gives this error: FeVariable interpolation at location (1.12784e-310, 0.307592) does not appear to be valid. Location is probably outside local domain.