createGridBounceBack[n_Integer?Positive,m_Integer?Positive,gridType_:"Rectangular"]:=Module[{surface,neigbourCoordinates,bulkDegree},(*Functions*)surface[grid_,boundaryVertex_]:=Module[{surfaceVector,position=PropertyValue[{grid,boundaryVertex},VertexCoordinates]},surfaceVector={position[[1]]/.{1.->-1.,N@n->1.,_->0},position[[2]]/.{1.->-1.,N@m->1.,_->0.}};surfaceVector/Norm@surfaceVector];(*Values*)Clear[grid,gridCoordinatesToIndex,gridBoundaries,gridNeighbourhood,gridBoundaryNormalVectors];Switch[gridType,"Rectangular",grid=GridGraph[{m,n}];bulkDegree=4,"RectangularDiag",grid=NearestNeighborGraph[GraphEmbedding@GridGraph[{m,n}],DistanceFunction->ChessboardDistance];bulkDegree=8;];gridCoordinatesToIndex=AssociationThread[GraphEmbedding@grid,VertexList[grid]];gridBoundaries=VertexList[grid,_?(VertexDegree[grid,#]<bulkDegree&)];gridBoundaryNormalVectors=AssociationThread[gridBoundaries,surface[grid,#]&/@gridBoundaries];gridNeighbourhood=generateNeighbourhoods@grid;]