milankl / ShallowWaters.jl

A type-flexible shallow water model that can run with 16-bit arithmetic.
MIT License
115 stars 20 forks source link

Precision resilient 2D Laplacian #152

Closed milankl closed 3 years ago

milankl commented 3 years ago

https://github.com/milankl/ShallowWaters.jl/blob/5b5746b29e61cedeb2beb761f81f9e5cdad9f2a0/src/Gradients.jl#L37

probably as

uij = u[j,i]
∇²u[j,i] = (u[j,i+1]-uij) + (u[j+2,i+1]-uij) + (u[j+1,i]-uij) + (u[j+1,i+2]-uij)
milankl commented 3 years ago

or

∇²u[j,i] = ((u[j-1,i]-uij) + (u[j+1,i]-uij)) + ((u[j,i-1]-uij) + (u[j,i+1]-uij))

note the brackets

milankl commented 3 years ago

done in #153