Boundary conditions on edges or nodes

Please format your code appropriately using ``` to encapsulate it.
Also, remove all unused imports and all lines that are commented out.
Make sure that the code is runnable if you do a copy-paste into an editor (that indentation is correct), and that it reproduces your error.
Follow all the instructions in: Read before posting: How do I get my question answered? - #3