{"action":"created","issue":{"url":"https://api.github.com/repos/erdc-cm/proteus/issues/199","labels_url":"https://api.github.com/repos/erdc-cm/proteus/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/erdc-cm/proteus/issues/199/comments","events_url":"https://api.github.com/repos/erdc-cm/proteus/issues/199/events","html_url":"https://github.com/erdc-cm/proteus/issues/199","id":55147010,"number":199,"title":"Cannot create a custom rectangular domain","user":{"login":"AlmostSurelyRob","id":773606,"avatar_url":"https://avatars.githubusercontent.com/u/773606?v=3","gravatar_id":"","url":"https://api.github.com/users/AlmostSurelyRob","html_url":"https://github.com/AlmostSurelyRob","followers_url":"https://api.github.com/users/AlmostSurelyRob/followers","following_url":"https://api.github.com/users/AlmostSurelyRob/following{/other_user}","gists_url":"https://api.github.com/users/AlmostSurelyRob/gists{/gist_id}","starred_url":"https://api.github.com/users/AlmostSurelyRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlmostSurelyRob/subscriptions","organizations_url":"https://api.github.com/users/AlmostSurelyRob/orgs","repos_url":"https://api.github.com/users/AlmostSurelyRob/repos","events_url":"https://api.github.com/users/AlmostSurelyRob/events{/privacy}","received_events_url":"https://api.github.com/users/AlmostSurelyRob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-22T12:22:28Z","updated_at":"2015-01-23T11:51:31Z","closed_at":null,"body":"Hello,\r\n\r\nI am trying to setup a rectangular domain where y in (-4,4) and I run into some difficulties. After going through DomainTutorial notebook I believe that the following should work:\r\n\r\n```python\r\n#kinetic.py\r\nimport proteus.default_p as p\r\n...\r\n# p.nd = 2\r\n# p.L = (2 * np.pi, 8)\r\n# p.x = (0, -4)  # This doesn't seem to affect NumericalSolution\r\n# Now trying to be more explcit about domain\r\np.domain = Domain.RectangularDomain(L=(2 * np.pi, 8), x=(0, -4), name=p.name)\r\n...\r\nns = NumericalSolution.NS_base(so, [p], [n], so.sList, opts)\r\nns.calculateSolution(\"kinetic\")\r\n```\r\n\r\nI looked up a couple of files so I understand that `default_p.domain = None` and I noticed that `NumericalSolution.py` has\r\n```python\r\n            if p.domain == None:\r\n                if p.nd == 1:\r\n                    p.domain = Domain.RectangularDomain(L=p.L[:1],name=p.name)\r\n                elif p.nd == 2:\r\n                    if p.polyfile != None:\r\n                        p.domain = Domain.PlanarStraightLineGraphDomain(fileprefix=p.polyfile,name=p.polyfile)\r\n                    else:\r\n                        p.domain = Domain.RectangularDomain(L=p.L[:2],name=p.name)\r\n                elif p.nd == 3:\r\n                    if p.polyfile != None:\r\n                        p.domain = Domain.PiecewiseLinearComplexDomain(fileprefix=p.polyfile,name=p.polyfile)\r\n                    elif p.meshfile != None:\r\n                        p.domain = Domain.Mesh3DMDomain(p.meshfile)\r\n                    else:\r\n                        p.domain = Domain.RectangularDomain(L=p.L[:3],name=p.name)\r\n                else:\r\n                    raise RuntimeError(\"No support for domains in more than three dimensions\")\r\n```\r\n\r\nThe file contains also the numerical and physics setup. I just run it with `python2 kinetic.py`. In the current form I get\r\n```\r\n[       0] *** Global ***\r\nNumber of triangles  : 800\r\nNumber of edges : 1240\r\nNumber of nodes : 441\r\n\r\n*** Local ***\r\nNumber of triangles  : 800\r\nNumber of edges : 1240\r\nNumber of nodes : 441\r\n\r\n[       0] Setting up MultilevelTransport for kinetic\r\n[       0] Building Transport for each mesh\r\n[       0] Generating Trial Space\r\n[0]PETSC ERROR: ------------------------------------------------------------------------\r\n[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range\r\n[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger\r\n[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors\r\n[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run\r\n[0]PETSC ERROR: to get more information on the crash.\r\napplication called MPI_Abort(MPI_COMM_WORLD, 59) - process 0\r\n```\r\nIf I uncomment `p.nd` and `p.L` lines the code will run, even though i believe I am doing exactly the same! Clearly there's something I am missing. Please let me know."},"comment":{"url":"https://api.github.com/repos/erdc-cm/proteus/issues/comments/71183308","html_url":"https://github.com/erdc-cm/proteus/issues/199#issuecomment-71183308","issue_url":"https://api.github.com/repos/erdc-cm/proteus/issues/199","id":71183308,"user":{"login":"AlmostSurelyRob","id":773606,"avatar_url":"https://avatars.githubusercontent.com/u/773606?v=3","gravatar_id":"","url":"https://api.github.com/users/AlmostSurelyRob","html_url":"https://github.com/AlmostSurelyRob","followers_url":"https://api.github.com/users/AlmostSurelyRob/followers","following_url":"https://api.github.com/users/AlmostSurelyRob/following{/other_user}","gists_url":"https://api.github.com/users/AlmostSurelyRob/gists{/gist_id}","starred_url":"https://api.github.com/users/AlmostSurelyRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlmostSurelyRob/subscriptions","organizations_url":"https://api.github.com/users/AlmostSurelyRob/orgs","repos_url":"https://api.github.com/users/AlmostSurelyRob/repos","events_url":"https://api.github.com/users/AlmostSurelyRob/events{/privacy}","received_events_url":"https://api.github.com/users/AlmostSurelyRob/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T11:51:31Z","updated_at":"2015-01-23T11:51:31Z","body":"I corrected my BC code. I didn't change anything to the periodic part as I want to have periodicity in x and 0 value for y direction. The problem went away.\r\n\r\n```python\r\ndef dirichletZeroBC(x, flag):\r\n    a = x[1]\r\n    print \"zeroBC: \", x\r\n    if np.abs(a) == 4:\r\n        return 0\r\n\r\np.dirichletConditions = dict((i, dirichletZeroBC) for i in range(2))\r\np.advectiveFluxBoundaryConditions = dict((i, emptyBC) for i in range(2))\r\np.diffusiveFluxBoundaryConditions = dict((i, {}) for i in range(2))\r\n\r\n\r\ndef getPBC(x, flag):\r\n    eps = 1.0e-8\r\n    print \"periodicBC\", x\r\n    if x[0] < eps or x[0] >= p.L[0] - eps:\r\n        return np.array([0.0, 0.0, 0.0])\r\n\r\np.periodicDirichletConditions = dict((i, getPBC) for i in range(2))\r\n```\r\nThis is still not quite correct for my case as the first variable is probably not fixed value, but I need to go back to the theory to verify this. It's irrelevant to this issue. The problem is closed for me. Before my BC code was empty for `p.dirichletConditions` so perhaps there was something default that was crashing the shifted rectangle."}}