{"action":"created","issue":{"url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/187","labels_url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/187/labels{/name}","comments_url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/187/comments","events_url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/187/events","html_url":"https://github.com/mit-crpg/OpenMOC/pull/187","id":97349118,"number":187,"title":"New adjoint calculation mode","user":{"login":"wbinventor","id":209492,"avatar_url":"https://avatars.githubusercontent.com/u/209492?v=3","gravatar_id":"","url":"https://api.github.com/users/wbinventor","html_url":"https://github.com/wbinventor","followers_url":"https://api.github.com/users/wbinventor/followers","following_url":"https://api.github.com/users/wbinventor/following{/other_user}","gists_url":"https://api.github.com/users/wbinventor/gists{/gist_id}","starred_url":"https://api.github.com/users/wbinventor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbinventor/subscriptions","organizations_url":"https://api.github.com/users/wbinventor/orgs","repos_url":"https://api.github.com/users/wbinventor/repos","events_url":"https://api.github.com/users/wbinventor/events{/privacy}","received_events_url":"https://api.github.com/users/wbinventor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mit-crpg/OpenMOC/labels/Enhancement","name":"Enhancement","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"cjosey","id":354602,"avatar_url":"https://avatars.githubusercontent.com/u/354602?v=3","gravatar_id":"","url":"https://api.github.com/users/cjosey","html_url":"https://github.com/cjosey","followers_url":"https://api.github.com/users/cjosey/followers","following_url":"https://api.github.com/users/cjosey/following{/other_user}","gists_url":"https://api.github.com/users/cjosey/gists{/gist_id}","starred_url":"https://api.github.com/users/cjosey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjosey/subscriptions","organizations_url":"https://api.github.com/users/cjosey/orgs","repos_url":"https://api.github.com/users/cjosey/repos","events_url":"https://api.github.com/users/cjosey/events{/privacy}","received_events_url":"https://api.github.com/users/cjosey/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mit-crpg/OpenMOC/milestones/3","html_url":"https://github.com/mit-crpg/OpenMOC/milestones/v0.1.5","labels_url":"https://api.github.com/repos/mit-crpg/OpenMOC/milestones/3/labels","id":980734,"number":3,"title":"v0.1.5","description":"","creator":{"login":"wbinventor","id":209492,"avatar_url":"https://avatars.githubusercontent.com/u/209492?v=3","gravatar_id":"","url":"https://api.github.com/users/wbinventor","html_url":"https://github.com/wbinventor","followers_url":"https://api.github.com/users/wbinventor/followers","following_url":"https://api.github.com/users/wbinventor/following{/other_user}","gists_url":"https://api.github.com/users/wbinventor/gists{/gist_id}","starred_url":"https://api.github.com/users/wbinventor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbinventor/subscriptions","organizations_url":"https://api.github.com/users/wbinventor/orgs","repos_url":"https://api.github.com/users/wbinventor/repos","events_url":"https://api.github.com/users/wbinventor/events{/privacy}","received_events_url":"https://api.github.com/users/wbinventor/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":38,"state":"open","created_at":"2015-02-16T04:36:42Z","updated_at":"2015-08-16T23:59:56Z","due_on":"2015-05-31T04:00:00Z","closed_at":null},"comments":36,"created_at":"2015-07-26T20:52:25Z","updated_at":"2015-08-21T03:27:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mit-crpg/OpenMOC/pulls/187","html_url":"https://github.com/mit-crpg/OpenMOC/pull/187","diff_url":"https://github.com/mit-crpg/OpenMOC/pull/187.diff","patch_url":"https://github.com/mit-crpg/OpenMOC/pull/187.patch"},"body":"This PR introduces a new adjoint calculation mode for both fixed source and criticality problems. The adjoint mode builds upon PRs #183 and #186 which made it surprisingly simple to this feature. There is a new ``solverMode`` enumerated type which can take on values ``FORWARD`` or ``ADJOINT``. All of the following routines have been modified to take a new ``mode`` parameter (which defaults to ``FORWARD``):\r\n\r\n* ``Solver::computeFlux(...)``\r\n* ``Solver::computeSource(...)``\r\n* ``Solver::computeEigenvalue(...)``\r\n\r\nThe following snippet illustrates how easily one may now toggle between ``FORWARD`` and ``ADJOINT`` modes:\r\n\r\n```python\r\nsolver.computeEigenvalue(max_iters=1000, mode=ADJOINT)\r\n```\r\n\r\nThe adjoint calculation mode is made possible by the new ``Material::transposeProductionMatrices()`` routine. If in ``ADJOINT`` mode, the ``Solver`` calls the routine when the materials are initialized. At the end of a calculation performed by one of the ``Solvers`` three main methods above, the new ``Solver::resetMaterials()`` routine will return each ``Material's`` production matrices to its original state.\r\n\r\nIn addition, this PR illustrates the use of the ``ADJOINT`` mode in the homogeneous one and two group sample input scripts. Per an email conversation with @robertsj, I've included some new code in each of these sample inputs which uses NumPy to solve for the forward and adjoint eigenvalues to compare with OpenMOC. \r\n\r\nOn a side note, this PR breaks ups the C5G7 inputs into an importable \"geometry.py\" file with separate scripts to run simulations in different modes (CPU/GPU, CMFD) akin to what was discussed in #165.\r\n\r\nBoth ``FORWARD`` and ``ADJOINT`` modes have been validated for the ``CPUSolver``, ``VectorizedSolver`` and ``GPUSolver``. However, I have not modified CMFD to work for an adjoint calculation. I believe that this would simply require making CMFD use the fission matrix per #186."},"comment":{"url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/comments/133267518","html_url":"https://github.com/mit-crpg/OpenMOC/pull/187#issuecomment-133267518","issue_url":"https://api.github.com/repos/mit-crpg/OpenMOC/issues/187","id":133267518,"user":{"login":"wbinventor","id":209492,"avatar_url":"https://avatars.githubusercontent.com/u/209492?v=3","gravatar_id":"","url":"https://api.github.com/users/wbinventor","html_url":"https://github.com/wbinventor","followers_url":"https://api.github.com/users/wbinventor/followers","following_url":"https://api.github.com/users/wbinventor/following{/other_user}","gists_url":"https://api.github.com/users/wbinventor/gists{/gist_id}","starred_url":"https://api.github.com/users/wbinventor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbinventor/subscriptions","organizations_url":"https://api.github.com/users/wbinventor/orgs","repos_url":"https://api.github.com/users/wbinventor/repos","events_url":"https://api.github.com/users/wbinventor/events{/privacy}","received_events_url":"https://api.github.com/users/wbinventor/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T03:27:37Z","updated_at":"2015-08-21T03:27:37Z","body":"This is now sync'ed up with the develop branch and is ready for final review and testing."}}