{"action":"created","comment":{"url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/comments/50372367","id":50372367,"diff_hunk":"@@ -0,0 +1,125 @@\n+#include \"palabos3D.h\"\n+#include \"palabos3D.hh\"\n+#include <vector>\n+#include <cmath>\n+\n+using namespace plb;\n+using namespace std;\n+\n+typedef double T;\n+#define DESCRIPTOR descriptors::D3Q19Descriptor\n+\n+// This function object returns a zero velocity, and a pressure which decreases\n+//   linearly in x-direction. It is used to initialize the particle populations.\n+class PressureGradient {\n+public:\n+        PressureGradient(T deltaP_, plint nx_) : deltaP(deltaP_), nx(nx_)\n+        { }\n+        void operator() (plint iX, plint iY, plint iZ, T& density, Array<T,3>& velocity) const\n+        {\n+                velocity.resetToZero();\n+                density = 1. - deltaP*DESCRIPTOR<T>::invCs2 / (T)(nx-1) * (T)iX;\n+        }\n+private:\n+        T deltaP;\n+        plint nx;\n+};\n+\n+void setupPressureDifferenceProblem( MultiBlockLattice3D<T,DESCRIPTOR>& lattice,\n+                       OnLatticeBoundaryCondition3D<T,DESCRIPTOR>* boundaryCondition,\n+                       MultiScalarField3D<int>& geometry, T deltaP)\n+{\n+        const plint nx = lattice.getNx();\n+        const plint ny = lattice.getNy();\n+        const plint nz = lattice.getNz();\n+\n+        Box3D inlet (0,0,      1,ny-2, 1,nz-2);\n+        boundaryCondition->addPressureBoundary0N(inlet, lattice);\n+        setBoundaryDensity(lattice, inlet, (T) 1.);\n+\n+        Box3D outlet(nx-1,nx-1, 1,ny-2, 1,nz-2);\n+        boundaryCondition->addPressureBoundary0P(outlet, lattice);\n+        setBoundaryDensity(lattice, outlet, (T) 1. - deltaP*DESCRIPTOR<T>::invCs2);\n+\n+        // Where \"geometry\" evaluates to 1 (solid boundary), use bounce-back.\n+        defineDynamics(lattice, geometry, new BounceBack<T,DESCRIPTOR>(), 1);\n+        // Where \"geometry\" evaluates to 2 (solid), use no-dynamics (which does nothing).\n+        defineDynamics(lattice, geometry, new NoDynamics<T,DESCRIPTOR>(), 2);\n+\n+        initializeAtEquilibrium( lattice, lattice.getBoundingBox(), PressureGradient(deltaP, nx) );\n+\n+        lattice.initialize();\n+        delete boundaryCondition;\n+}\n+\n+void writeVTK_velocity(MultiBlockLattice3D<T,DESCRIPTOR>& lattice, string fname)\n+{\n+        VtkImageOutput3D<T> vtkOut(fname.c_str(), 1.);\n+        vtkOut.writeData<3,float>(*computeVelocity(lattice), \"velocity\", 1.);\n+}\n+\n+void writeVTK_density(MultiBlockLattice3D<T,DESCRIPTOR>& lattice, string fname)\n+{\n+        VtkImageOutput3D<T> vtkOut(fname.c_str(), 1.);\n+        vtkOut.writeData<float>(*computeDensity(lattice), \"density\", 1.);\n+}\n+\n+int main(int argc, char **argv)\n+{\n+        plbInit(&argc, &argv);\n+        global::directories().setOutputDir(\"./\");\n+\n+        if (argc < 2) {\n+            pcout << \"SimPhoNy-Palabos file-IO wrapper\" << endl;","path":"palabos/source/plb_pressure_diff.cpp","position":73,"original_position":73,"commit_id":"b4eb7fe3323ed48207bb129098e87dd7da9ee510","original_commit_id":"b4eb7fe3323ed48207bb129098e87dd7da9ee510","user":{"login":"tuopuu","id":8424971,"avatar_url":"https://avatars.githubusercontent.com/u/8424971?v=3","gravatar_id":"","url":"https://api.github.com/users/tuopuu","html_url":"https://github.com/tuopuu","followers_url":"https://api.github.com/users/tuopuu/followers","following_url":"https://api.github.com/users/tuopuu/following{/other_user}","gists_url":"https://api.github.com/users/tuopuu/gists{/gist_id}","starred_url":"https://api.github.com/users/tuopuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuopuu/subscriptions","organizations_url":"https://api.github.com/users/tuopuu/orgs","repos_url":"https://api.github.com/users/tuopuu/repos","events_url":"https://api.github.com/users/tuopuu/events{/privacy}","received_events_url":"https://api.github.com/users/tuopuu/received_events","type":"User","site_admin":false},"body":"Good catch. I'll write a more complete \"program header\" here. User is not supposed to directly run these executables, but still some kind of documentation of the command line parameters should be given.","created_at":"2016-01-21T08:38:30Z","updated_at":"2016-01-21T08:38:30Z","html_url":"https://github.com/simphony/simphony-palabos/pull/1#discussion_r50372367","pull_request_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/comments/50372367"},"html":{"href":"https://github.com/simphony/simphony-palabos/pull/1#discussion_r50372367"},"pull_request":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1","id":56642102,"html_url":"https://github.com/simphony/simphony-palabos/pull/1","diff_url":"https://github.com/simphony/simphony-palabos/pull/1.diff","patch_url":"https://github.com/simphony/simphony-palabos/pull/1.patch","issue_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/1","number":1,"state":"open","locked":false,"title":"WIP: FileIO wrapper","user":{"login":"tuopuu","id":8424971,"avatar_url":"https://avatars.githubusercontent.com/u/8424971?v=3","gravatar_id":"","url":"https://api.github.com/users/tuopuu","html_url":"https://github.com/tuopuu","followers_url":"https://api.github.com/users/tuopuu/followers","following_url":"https://api.github.com/users/tuopuu/following{/other_user}","gists_url":"https://api.github.com/users/tuopuu/gists{/gist_id}","starred_url":"https://api.github.com/users/tuopuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuopuu/subscriptions","organizations_url":"https://api.github.com/users/tuopuu/orgs","repos_url":"https://api.github.com/users/tuopuu/repos","events_url":"https://api.github.com/users/tuopuu/events{/privacy}","received_events_url":"https://api.github.com/users/tuopuu/received_events","type":"User","site_admin":false},"body":"Simphony fileIO wrapper for Palabos lattice-Boltzmann simulation library.","created_at":"2016-01-20T17:43:57Z","updated_at":"2016-01-21T08:38:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6a6c801e053ee2df02ec60f36b95d23c2974bb9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1/commits","review_comments_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1/comments","review_comment_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/1/comments","statuses_url":"https://api.github.com/repos/simphony/simphony-palabos/statuses/b4eb7fe3323ed48207bb129098e87dd7da9ee510","head":{"label":"simphony:feature_fileio_wrapper","ref":"feature_fileio_wrapper","sha":"b4eb7fe3323ed48207bb129098e87dd7da9ee510","user":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"repo":{"id":49955335,"name":"simphony-palabos","full_name":"simphony/simphony-palabos","owner":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/simphony/simphony-palabos","description":"A file-io based wrapper for Palabos LB library","fork":false,"url":"https://api.github.com/repos/simphony/simphony-palabos","forks_url":"https://api.github.com/repos/simphony/simphony-palabos/forks","keys_url":"https://api.github.com/repos/simphony/simphony-palabos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-palabos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-palabos/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-palabos/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-palabos/events","assignees_url":"https://api.github.com/repos/simphony/simphony-palabos/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-palabos/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-palabos/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-palabos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-palabos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-palabos/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-palabos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-palabos/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-palabos/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-palabos/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-palabos/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-palabos/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-palabos/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-palabos/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-palabos/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-palabos/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-palabos/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-palabos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-palabos/merges","archive_url":"https://api.github.com/repos/simphony/simphony-palabos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-palabos/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-palabos/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-palabos/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-palabos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-palabos/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-palabos/releases{/id}","created_at":"2016-01-19T13:44:47Z","updated_at":"2016-01-19T13:44:47Z","pushed_at":"2016-01-20T17:43:57Z","git_url":"git://github.com/simphony/simphony-palabos.git","ssh_url":"git@github.com:simphony/simphony-palabos.git","clone_url":"https://github.com/simphony/simphony-palabos.git","svn_url":"https://github.com/simphony/simphony-palabos","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"simphony:master","ref":"master","sha":"0519883307a9fcda0301b4711232aeac0f389f11","user":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"repo":{"id":49955335,"name":"simphony-palabos","full_name":"simphony/simphony-palabos","owner":{"login":"simphony","id":8048249,"avatar_url":"https://avatars.githubusercontent.com/u/8048249?v=3","gravatar_id":"","url":"https://api.github.com/users/simphony","html_url":"https://github.com/simphony","followers_url":"https://api.github.com/users/simphony/followers","following_url":"https://api.github.com/users/simphony/following{/other_user}","gists_url":"https://api.github.com/users/simphony/gists{/gist_id}","starred_url":"https://api.github.com/users/simphony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simphony/subscriptions","organizations_url":"https://api.github.com/users/simphony/orgs","repos_url":"https://api.github.com/users/simphony/repos","events_url":"https://api.github.com/users/simphony/events{/privacy}","received_events_url":"https://api.github.com/users/simphony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/simphony/simphony-palabos","description":"A file-io based wrapper for Palabos LB library","fork":false,"url":"https://api.github.com/repos/simphony/simphony-palabos","forks_url":"https://api.github.com/repos/simphony/simphony-palabos/forks","keys_url":"https://api.github.com/repos/simphony/simphony-palabos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simphony/simphony-palabos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simphony/simphony-palabos/teams","hooks_url":"https://api.github.com/repos/simphony/simphony-palabos/hooks","issue_events_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/events{/number}","events_url":"https://api.github.com/repos/simphony/simphony-palabos/events","assignees_url":"https://api.github.com/repos/simphony/simphony-palabos/assignees{/user}","branches_url":"https://api.github.com/repos/simphony/simphony-palabos/branches{/branch}","tags_url":"https://api.github.com/repos/simphony/simphony-palabos/tags","blobs_url":"https://api.github.com/repos/simphony/simphony-palabos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simphony/simphony-palabos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simphony/simphony-palabos/git/refs{/sha}","trees_url":"https://api.github.com/repos/simphony/simphony-palabos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simphony/simphony-palabos/statuses/{sha}","languages_url":"https://api.github.com/repos/simphony/simphony-palabos/languages","stargazers_url":"https://api.github.com/repos/simphony/simphony-palabos/stargazers","contributors_url":"https://api.github.com/repos/simphony/simphony-palabos/contributors","subscribers_url":"https://api.github.com/repos/simphony/simphony-palabos/subscribers","subscription_url":"https://api.github.com/repos/simphony/simphony-palabos/subscription","commits_url":"https://api.github.com/repos/simphony/simphony-palabos/commits{/sha}","git_commits_url":"https://api.github.com/repos/simphony/simphony-palabos/git/commits{/sha}","comments_url":"https://api.github.com/repos/simphony/simphony-palabos/comments{/number}","issue_comment_url":"https://api.github.com/repos/simphony/simphony-palabos/issues/comments{/number}","contents_url":"https://api.github.com/repos/simphony/simphony-palabos/contents/{+path}","compare_url":"https://api.github.com/repos/simphony/simphony-palabos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simphony/simphony-palabos/merges","archive_url":"https://api.github.com/repos/simphony/simphony-palabos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simphony/simphony-palabos/downloads","issues_url":"https://api.github.com/repos/simphony/simphony-palabos/issues{/number}","pulls_url":"https://api.github.com/repos/simphony/simphony-palabos/pulls{/number}","milestones_url":"https://api.github.com/repos/simphony/simphony-palabos/milestones{/number}","notifications_url":"https://api.github.com/repos/simphony/simphony-palabos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simphony/simphony-palabos/labels{/name}","releases_url":"https://api.github.com/repos/simphony/simphony-palabos/releases{/id}","created_at":"2016-01-19T13:44:47Z","updated_at":"2016-01-19T13:44:47Z","pushed_at":"2016-01-20T17:43:57Z","git_url":"git://github.com/simphony/simphony-palabos.git","ssh_url":"git@github.com:simphony/simphony-palabos.git","clone_url":"https://github.com/simphony/simphony-palabos.git","svn_url":"https://github.com/simphony/simphony-palabos","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1"},"html":{"href":"https://github.com/simphony/simphony-palabos/pull/1"},"issue":{"href":"https://api.github.com/repos/simphony/simphony-palabos/issues/1"},"comments":{"href":"https://api.github.com/repos/simphony/simphony-palabos/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/simphony/simphony-palabos/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/simphony/simphony-palabos/statuses/b4eb7fe3323ed48207bb129098e87dd7da9ee510"}}}}