ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0,
It has to do with your coding style. Your code is too similar to mathematical notion. Issues include doing too much on single line and operator precedence in Python

Your code:

vnew = dt * Minv @ (f*src[it]  -  (Kv @ v) -  (Ku @ u)) + v 


Breaking into simpler statements would allow for easier debugging.

term_1 = (f*src[it])  -  (Kv @ v) -  (Ku @ u)
term_2 = term_1 + v
term_3 =  Minv @ term_2
vnew = dt * term_3