{"action":"created","comment":{"url":"https://api.github.com/repos/vincentlab/PyFR/pulls/comments/29286019","id":29286019,"diff_hunk":"@@ -16,15 +20,68 @@ def set_backend(self, backend, nscalupts):\n                        visc_corr=visc_corr,\n                        c=self.cfg.items_as('constants', float))\n \n+        if self.cfg.getfloat('solver-avis', 'amu0', 0.0):\n+            amu = self._avis_upts\n+            tplargs.update(dict(art_vis='mu'))\n+        else:\n+            amu = None\n+            tplargs.update(dict(art_vis='none'))\n+\n         if 'flux' in self.antialias:\n             self.kernels['tdisf'] = lambda: backend.kernel(\n                 'tflux', tplargs=tplargs, dims=[self.nqpts, self.neles],\n                 u=self._scal_qpts, smats=self.smat_at('qpts'),\n-                f=self._vect_qpts\n+                f=self._vect_qpts, amu=amu\n             )\n         else:\n             self.kernels['tdisf'] = lambda: backend.kernel(\n                 'tflux', tplargs=tplargs, dims=[self.nupts, self.neles],\n                 u=self.scal_upts_inb, smats=self.smat_at('upts'),\n-                f=self._vect_upts\n+                f=self._vect_upts, amu=amu\n             )\n+\n+        # Kernels for artificial viscosity\n+        if amu:\n+            backend.pointwise.register('pyfr.solvers.navstokes.kernels.entropy')\n+            backend.pointwise.register('pyfr.solvers.navstokes.kernels.avis')\n+\n+            def artf_vis():\n+                # Compute entropy and save to avis_upts\n+                ent = backend.kernel('entropy', tplargs=tplargs, dims=[self.nupts, self.neles],\n+                                     u=self.scal_upts_inb, s=self._avis_upts)\n+\n+                # Compute modal coefficients of entropy and save them to avis_upts_temp\n+                rcpvdm = np.linalg.inv(self._basis.ubasis.vdm.T)\n+                rcpvdm = self._be.const_matrix(rcpvdm, tags={'inVdm', 'align'})\n+                mul = backend.kernel('mul', rcpvdm, self._avis_upts, out=self._avis_upts_temp)\n+\n+                # Additional constants for element-wise artificial viscosity kernel\n+                ubdegs = self._basis.ubasis.degrees\n+                tplargs['c'].update(self.cfg.items_as('solver-avis', float))","path":"pyfr/solvers/navstokes/elements.py","position":55,"original_position":55,"commit_id":"5ff1df510f91a1cb56352ccb178c6762603a6cf9","original_commit_id":"5ff1df510f91a1cb56352ccb178c6762603a6cf9","user":{"login":"FreddieWitherden","id":528611,"avatar_url":"https://avatars.githubusercontent.com/u/528611?v=3","gravatar_id":"","url":"https://api.github.com/users/FreddieWitherden","html_url":"https://github.com/FreddieWitherden","followers_url":"https://api.github.com/users/FreddieWitherden/followers","following_url":"https://api.github.com/users/FreddieWitherden/following{/other_user}","gists_url":"https://api.github.com/users/FreddieWitherden/gists{/gist_id}","starred_url":"https://api.github.com/users/FreddieWitherden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreddieWitherden/subscriptions","organizations_url":"https://api.github.com/users/FreddieWitherden/orgs","repos_url":"https://api.github.com/users/FreddieWitherden/repos","events_url":"https://api.github.com/users/FreddieWitherden/events{/privacy}","received_events_url":"https://api.github.com/users/FreddieWitherden/received_events","type":"User","site_admin":false},"body":"`[solver-artifical-viscosity]` may be clearer","created_at":"2015-04-28T20:40:31Z","updated_at":"2015-04-28T20:40:31Z","html_url":"https://github.com/vincentlab/PyFR/pull/46#discussion_r29286019","pull_request_url":"https://api.github.com/repos/vincentlab/PyFR/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/comments/29286019"},"html":{"href":"https://github.com/vincentlab/PyFR/pull/46#discussion_r29286019"},"pull_request":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/vincentlab/PyFR/pulls/46","id":33979770,"html_url":"https://github.com/vincentlab/PyFR/pull/46","diff_url":"https://github.com/vincentlab/PyFR/pull/46.diff","patch_url":"https://github.com/vincentlab/PyFR/pull/46.patch","issue_url":"https://api.github.com/repos/vincentlab/PyFR/issues/46","number":46,"state":"open","locked":false,"title":"Added Persson's artificial viscosity (AIAA 2006-0112).","user":{"login":"Aerojspark","id":8792917,"avatar_url":"https://avatars.githubusercontent.com/u/8792917?v=3","gravatar_id":"","url":"https://api.github.com/users/Aerojspark","html_url":"https://github.com/Aerojspark","followers_url":"https://api.github.com/users/Aerojspark/followers","following_url":"https://api.github.com/users/Aerojspark/following{/other_user}","gists_url":"https://api.github.com/users/Aerojspark/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerojspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerojspark/subscriptions","organizations_url":"https://api.github.com/users/Aerojspark/orgs","repos_url":"https://api.github.com/users/Aerojspark/repos","events_url":"https://api.github.com/users/Aerojspark/events{/privacy}","received_events_url":"https://api.github.com/users/Aerojspark/received_events","type":"User","site_admin":false},"body":"I have added Persson's artificial viscosity scheme (AIAA 2006-0112). It requires three tuning parameters, which is defined in [solver-avis] section.\r\n\r\namu0 : maximum amount of artificial viscosity ~ h/p\r\ns0 : cut-off of the smooth indicator ~ 1/p^4\r\nkappa : range of the smooth indicator ~ empirically large\r\n\r\nTo get a proper values of them, you need to some (or many) trial-and-errors. \r\n\r\nThis scheme is only working for Navier-Stokes system. If you want to simulate inviscid shock wave  flow, you should impose viscosity (mu in [solver] section) as 0.0.","created_at":"2015-04-23T17:51:36Z","updated_at":"2015-04-28T20:40:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffdc41088cd4e382d18aeaa67c2e6a476fb8919d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vincentlab/PyFR/pulls/46/commits","review_comments_url":"https://api.github.com/repos/vincentlab/PyFR/pulls/46/comments","review_comment_url":"https://api.github.com/repos/vincentlab/PyFR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vincentlab/PyFR/issues/46/comments","statuses_url":"https://api.github.com/repos/vincentlab/PyFR/statuses/5ff1df510f91a1cb56352ccb178c6762603a6cf9","head":{"label":"Aerojspark:develop","ref":"develop","sha":"5ff1df510f91a1cb56352ccb178c6762603a6cf9","user":{"login":"Aerojspark","id":8792917,"avatar_url":"https://avatars.githubusercontent.com/u/8792917?v=3","gravatar_id":"","url":"https://api.github.com/users/Aerojspark","html_url":"https://github.com/Aerojspark","followers_url":"https://api.github.com/users/Aerojspark/followers","following_url":"https://api.github.com/users/Aerojspark/following{/other_user}","gists_url":"https://api.github.com/users/Aerojspark/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerojspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerojspark/subscriptions","organizations_url":"https://api.github.com/users/Aerojspark/orgs","repos_url":"https://api.github.com/users/Aerojspark/repos","events_url":"https://api.github.com/users/Aerojspark/events{/privacy}","received_events_url":"https://api.github.com/users/Aerojspark/received_events","type":"User","site_admin":false},"repo":{"id":24884060,"name":"PyFR","full_name":"Aerojspark/PyFR","owner":{"login":"Aerojspark","id":8792917,"avatar_url":"https://avatars.githubusercontent.com/u/8792917?v=3","gravatar_id":"","url":"https://api.github.com/users/Aerojspark","html_url":"https://github.com/Aerojspark","followers_url":"https://api.github.com/users/Aerojspark/followers","following_url":"https://api.github.com/users/Aerojspark/following{/other_user}","gists_url":"https://api.github.com/users/Aerojspark/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerojspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerojspark/subscriptions","organizations_url":"https://api.github.com/users/Aerojspark/orgs","repos_url":"https://api.github.com/users/Aerojspark/repos","events_url":"https://api.github.com/users/Aerojspark/events{/privacy}","received_events_url":"https://api.github.com/users/Aerojspark/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Aerojspark/PyFR","description":"PyFR","fork":true,"url":"https://api.github.com/repos/Aerojspark/PyFR","forks_url":"https://api.github.com/repos/Aerojspark/PyFR/forks","keys_url":"https://api.github.com/repos/Aerojspark/PyFR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Aerojspark/PyFR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Aerojspark/PyFR/teams","hooks_url":"https://api.github.com/repos/Aerojspark/PyFR/hooks","issue_events_url":"https://api.github.com/repos/Aerojspark/PyFR/issues/events{/number}","events_url":"https://api.github.com/repos/Aerojspark/PyFR/events","assignees_url":"https://api.github.com/repos/Aerojspark/PyFR/assignees{/user}","branches_url":"https://api.github.com/repos/Aerojspark/PyFR/branches{/branch}","tags_url":"https://api.github.com/repos/Aerojspark/PyFR/tags","blobs_url":"https://api.github.com/repos/Aerojspark/PyFR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Aerojspark/PyFR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Aerojspark/PyFR/git/refs{/sha}","trees_url":"https://api.github.com/repos/Aerojspark/PyFR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Aerojspark/PyFR/statuses/{sha}","languages_url":"https://api.github.com/repos/Aerojspark/PyFR/languages","stargazers_url":"https://api.github.com/repos/Aerojspark/PyFR/stargazers","contributors_url":"https://api.github.com/repos/Aerojspark/PyFR/contributors","subscribers_url":"https://api.github.com/repos/Aerojspark/PyFR/subscribers","subscription_url":"https://api.github.com/repos/Aerojspark/PyFR/subscription","commits_url":"https://api.github.com/repos/Aerojspark/PyFR/commits{/sha}","git_commits_url":"https://api.github.com/repos/Aerojspark/PyFR/git/commits{/sha}","comments_url":"https://api.github.com/repos/Aerojspark/PyFR/comments{/number}","issue_comment_url":"https://api.github.com/repos/Aerojspark/PyFR/issues/comments{/number}","contents_url":"https://api.github.com/repos/Aerojspark/PyFR/contents/{+path}","compare_url":"https://api.github.com/repos/Aerojspark/PyFR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Aerojspark/PyFR/merges","archive_url":"https://api.github.com/repos/Aerojspark/PyFR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Aerojspark/PyFR/downloads","issues_url":"https://api.github.com/repos/Aerojspark/PyFR/issues{/number}","pulls_url":"https://api.github.com/repos/Aerojspark/PyFR/pulls{/number}","milestones_url":"https://api.github.com/repos/Aerojspark/PyFR/milestones{/number}","notifications_url":"https://api.github.com/repos/Aerojspark/PyFR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Aerojspark/PyFR/labels{/name}","releases_url":"https://api.github.com/repos/Aerojspark/PyFR/releases{/id}","created_at":"2014-10-07T09:22:28Z","updated_at":"2015-04-24T17:17:29Z","pushed_at":"2015-04-24T17:17:29Z","git_url":"git://github.com/Aerojspark/PyFR.git","ssh_url":"git@github.com:Aerojspark/PyFR.git","clone_url":"https://github.com/Aerojspark/PyFR.git","svn_url":"https://github.com/Aerojspark/PyFR","homepage":"","size":1890,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"vincentlab:develop","ref":"develop","sha":"499bc0788961af1ee878ee55ec5e45cec15758e8","user":{"login":"vincentlab","id":3252468,"avatar_url":"https://avatars.githubusercontent.com/u/3252468?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentlab","html_url":"https://github.com/vincentlab","followers_url":"https://api.github.com/users/vincentlab/followers","following_url":"https://api.github.com/users/vincentlab/following{/other_user}","gists_url":"https://api.github.com/users/vincentlab/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentlab/subscriptions","organizations_url":"https://api.github.com/users/vincentlab/orgs","repos_url":"https://api.github.com/users/vincentlab/repos","events_url":"https://api.github.com/users/vincentlab/events{/privacy}","received_events_url":"https://api.github.com/users/vincentlab/received_events","type":"Organization","site_admin":false},"repo":{"id":7652671,"name":"PyFR","full_name":"vincentlab/PyFR","owner":{"login":"vincentlab","id":3252468,"avatar_url":"https://avatars.githubusercontent.com/u/3252468?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentlab","html_url":"https://github.com/vincentlab","followers_url":"https://api.github.com/users/vincentlab/followers","following_url":"https://api.github.com/users/vincentlab/following{/other_user}","gists_url":"https://api.github.com/users/vincentlab/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentlab/subscriptions","organizations_url":"https://api.github.com/users/vincentlab/orgs","repos_url":"https://api.github.com/users/vincentlab/repos","events_url":"https://api.github.com/users/vincentlab/events{/privacy}","received_events_url":"https://api.github.com/users/vincentlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vincentlab/PyFR","description":"PyFR","fork":false,"url":"https://api.github.com/repos/vincentlab/PyFR","forks_url":"https://api.github.com/repos/vincentlab/PyFR/forks","keys_url":"https://api.github.com/repos/vincentlab/PyFR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vincentlab/PyFR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vincentlab/PyFR/teams","hooks_url":"https://api.github.com/repos/vincentlab/PyFR/hooks","issue_events_url":"https://api.github.com/repos/vincentlab/PyFR/issues/events{/number}","events_url":"https://api.github.com/repos/vincentlab/PyFR/events","assignees_url":"https://api.github.com/repos/vincentlab/PyFR/assignees{/user}","branches_url":"https://api.github.com/repos/vincentlab/PyFR/branches{/branch}","tags_url":"https://api.github.com/repos/vincentlab/PyFR/tags","blobs_url":"https://api.github.com/repos/vincentlab/PyFR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vincentlab/PyFR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vincentlab/PyFR/git/refs{/sha}","trees_url":"https://api.github.com/repos/vincentlab/PyFR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vincentlab/PyFR/statuses/{sha}","languages_url":"https://api.github.com/repos/vincentlab/PyFR/languages","stargazers_url":"https://api.github.com/repos/vincentlab/PyFR/stargazers","contributors_url":"https://api.github.com/repos/vincentlab/PyFR/contributors","subscribers_url":"https://api.github.com/repos/vincentlab/PyFR/subscribers","subscription_url":"https://api.github.com/repos/vincentlab/PyFR/subscription","commits_url":"https://api.github.com/repos/vincentlab/PyFR/commits{/sha}","git_commits_url":"https://api.github.com/repos/vincentlab/PyFR/git/commits{/sha}","comments_url":"https://api.github.com/repos/vincentlab/PyFR/comments{/number}","issue_comment_url":"https://api.github.com/repos/vincentlab/PyFR/issues/comments{/number}","contents_url":"https://api.github.com/repos/vincentlab/PyFR/contents/{+path}","compare_url":"https://api.github.com/repos/vincentlab/PyFR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vincentlab/PyFR/merges","archive_url":"https://api.github.com/repos/vincentlab/PyFR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vincentlab/PyFR/downloads","issues_url":"https://api.github.com/repos/vincentlab/PyFR/issues{/number}","pulls_url":"https://api.github.com/repos/vincentlab/PyFR/pulls{/number}","milestones_url":"https://api.github.com/repos/vincentlab/PyFR/milestones{/number}","notifications_url":"https://api.github.com/repos/vincentlab/PyFR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vincentlab/PyFR/labels{/name}","releases_url":"https://api.github.com/repos/vincentlab/PyFR/releases{/id}","created_at":"2013-01-16T19:53:24Z","updated_at":"2015-04-26T17:17:48Z","pushed_at":"2015-04-28T13:28:16Z","git_url":"git://github.com/vincentlab/PyFR.git","ssh_url":"git@github.com:vincentlab/PyFR.git","clone_url":"https://github.com/vincentlab/PyFR.git","svn_url":"https://github.com/vincentlab/PyFR","homepage":"","size":4068,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":6,"forks":24,"open_issues":6,"watchers":18,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/46"},"html":{"href":"https://github.com/vincentlab/PyFR/pull/46"},"issue":{"href":"https://api.github.com/repos/vincentlab/PyFR/issues/46"},"comments":{"href":"https://api.github.com/repos/vincentlab/PyFR/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vincentlab/PyFR/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/vincentlab/PyFR/statuses/5ff1df510f91a1cb56352ccb178c6762603a6cf9"}}}}