Open navidcy opened 3 years ago
I checked the code again, there was some issue with the boundary conditions, but it still doesn't seem to work. But if I implement the periodic boundary conditions, the waves can be seen, but their shape isn't perfect.
The issue with Dirichlet boundary conditions was:
# Dirichlet BC
um_new[0] = 0
um_new[-1] = 0
hm_new[0] = 1
hm_new[-1] = 1
vm_new[0] = 0
vm_new[1] = 0
As you can see, for vm_new
, the boundary conditions are applied on the two cells at left edges. This is incorrect, but there's still some error. So, I'll agree with you, the Dirichlet boundary conditions aren't applied correctly. Do you know of any better way?
I never really understood how BCs are applied after the end of the timestep. In my head the differential operators should be aware pf them. Perhaps what I’m saying is equivalent. I’m tired now to think straight. Will give it more thought when I wake up and potentially we can zoom tomorrow.
Wait, why v has zeros at index 0 and 1??
Let’s chat about this issue. I feel you have some trouble systematically deriving the discretized version of the eqs. Is this true or have I misunderstood?
You mention "2. The non-conservative form works well until the 2 waves reach the boundaries, where the interaction with boundary points creates very high derivatives, thereby making the scheme unstable. This is where the conservative form shines - it can deal with these large derivatives well."
These errors that the animation shows are a bit too much to just blame the non-conservative scheme. I'm not 100% sure, but if I had to bet there is something fishy with the way the boundary conditions are implemented here.