{ "info": { "author": "Duncan Hunter", "author_email": "dunchunter@hotmail.co.uk", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "# pipemesh\nThese tools use the GMSH-SDK (or GMSH-API), available [here](http://gmsh.info/).\n\nThe documentation for pipemesh can be found [here](https://pipemesh.readthedocs.io/en/latest/).\n\n## Requirements:\n- libgmsh.so, libgmsh.so.4.3, libgmsh.so.4.3.0 (or higher) from the GMSH SDK. Download the SDK and navigate to the lib/ folder to find these, or use the versions hosted in this repository.\n- SciPy (and NumPy, installed with SciPy).\n\n*pipemesh* is currently only supported on Linux systems (e.g. Ubuntu 16, 18).\n\n## Installation\n\n```bash\n$python3 -m pip install --user pipemesh\n```\n\nOnce completed, navigate to site-packages/pipemesh of the python installation used. Place the files libgmsh.so, libgmsh.so.4.3 and libgmsh.so.4.3.0 in this folder.\n\nA virtual environment can be useful to locate the site-packages directory more easily.\n\n```bash\n# If you don't have venv\n$sudo apt-get install python3-venv\n\n$mkdir virtual_env # Name of your virtual environment\n$python3 -m venv virtual_env\n$source virtual_env/bin/activate\n$python3 -m pip install \u2013upgrade pip\n$python3 -m pip install --user scipy\n$python3 -m pip install --user pipemesh\n```\nThen simply place the libgmsh files into virtual_env/lib/site-packages/pipemesh/. Ensure to use the virtual environment every time you need to use *pipemesh*.\n\nIf you really don't want to use pip to install, clone the repository, and add acse-9.../pipemesh/ to PATH so python can find it.\n\n### pipes.py\nOnce installed, scripts to generate pipe and pipe network meshes can be created. A script is started by creating the *Network* object:\n```python\nfrom pipemesh import pipes\nnetwork = pipes.Network(1, 0.3, [1,0,0], 0.1)\n```\nThen added to using one of the following commands:\n```python\nnetwork.add_cylinder(1, 0.1, out_number=1)\nnetwork.add_t_junction([-1,-1,0], 0.05)\nnetwork.add_curve([0,1,0], 0.5, 0.05)\nnetwork.add_mitered([0, 1, 0], 0.05, out_number=2)\n```\nWhere out_number specifies which outlet of the pipe the piece will be added to. For more information on each function, please visit the documentation linked above.\n\nExamples:\n* Chicane with mitered bends:\n![chicane](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/network2.png)\n```python\nnetwork = pipes.Network(1, 0.3, [1,0,0], 0.1)\nnetwork.add_cylinder(1, 0.1)\nnetwork.add_mitered([0,1,0], 0.1)\nnetwork.add_cylinder(1, 0.1)\nnetwork.add_mitered([1,0,0], 0.1)\nnetwork.add_cylinder(1, 0.1)\n```\n* Pipe with two junctions:\n![network](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/network.png)\n```python\nnetwork.add_t_junction([-1,1,0], 0.05)\nnetwork.add_t_junction([-1,-1,0], 0.05)\nnetwork.add_cylinder(1, 0.1, out_number=2)\nnetwork.add_curve([-1,0,0], 0.5, 0.05, out_number=3)\nnetwork.add_cylinder(1.5, 0.1, out_number=3)\n```\n\nOnce the Network is complete, you can fuse the objects together and create physical surfaces and volumes, and set the local mesh sizes. Information can be obtained and written to file. This is all done with one call.\n```python\nnetwork.generate(filename=\"example\", binary=False, write_info=False, mesh_format=\"msh2\", write_xml=False run_gui=False)\n```\nWhich will write the file \"example.msh\", as a msh2 binary file.\n\nNetwork has get_phys_ids methods, which can be used with AutoMPML.\n\n### AutoMPML\nThe file auto_mpml.py contains the class *AutoMPML*. This edits a basic pipe flow simulation .mpml file used with IC-FERST by inputting the user values in the right places. This isn't actually automatic, but can save time by not editing mpml files with Diamond. Options that can be changed are relevant to conducting a pipe flow investigation with [IC-FERST](http://multifluids.github.io/).\n\nExample:\n```python\nfrom pipemesh import pipes\nfrom pipemesh.icferst import auto_mpml\n\n# Generate a network\nnetwork = pipes.Network(0.1, 0.3, [0, 0, -1], 0.1)\nnetwork.add_t_junction([1, 0, 1], 0.1)\nnetwork.generate(filename=\"pipe\", binary=True, write_info=True, write_xml=True, run_gui=False)\n\n# Get physical ids of inlets and outlets\nentry_phys_ids = network.get_inlet_outlet_phys_ids()\n# Get physical ids of cylinder surfaces\ncyl_phys_ids = network.get_cyl_phys_ids()\n# Select the inlet and the first outlet as inlets\ninlets = entry_phys_ids[:2]\n# Select the remainding inlet/outlets as outlets\noutlets = entry_phys_ids[2:]\n\n# Get velocity vectors for velocity magnitude 0.02\nvel = 0.02\ninlet_velocities = network.get_velocities_vel_mag(inlets, vel, 1000, 1e-3)\n\n# Create options object\noptions = auto_mpml.AutoMPML()\n# Change various options (the defaults are fairly sensible)\noptions.set_all(sim_name=\"junction_flow_test_case\",\n msh_file=\"src/pipe\",\n dump_ids=entry_phys_ids,\n density=1000,\n inlet_phys_ids=inlets, inlet_velocities=inlet_velocities,\n outlet_phys_ids=outlets,\n cyl_phys_ids=cyl_phys_ids,\n max_no_nodes=10000,\n min_mesh_size=0.2,\n finish_time=1.0,\n t_adapt_delay=0.5\n )\n# Write mpml file - extension not needed.\noptions.write_mpml(\"generated_mpml\")\n```\nAs the options can be set in python, this means that multiple simulations can be set up, with for example, varying reynolds numbers or varying input surfaces. For full information on what settings can be changed, visit the documentation.\n\n### pieces.py\nContains classes (and some useful functions for said classes) which represent cylindrical GMSH objects. The classes store information of the object, such as the centre and direction of its faces, as well as functions to update the information when transformations are applied to them. This makes the information a little easier to access than using just the GMSH API. To use these individually start your file with:\n\n```python\nfrom pipemesh import pieces, gmsh\nmodel = gmsh.model\nmesh = model.mesh\ngmsh.initialize()\ngmsh.option.setNumber(\"Mesh.CharacteristicLengthMax\", 0.1) # max mesh length\nmodel.add(\"Example\") # optional, add a model name.\n```\n\nThe available pieces to put in are:\n* Cylinder\n![cylinder](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/cylinder.png)\n```python\npiece = pieces.Cylinder(1, 0.5, [1,0,0], 0.1)\n# Length, radius, direction, mesh size\n```\n* Cylinder with changing radius\n![change_rad](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/change_radius.png)\n```python\npiece = pieces.ChangeRadius(2, 1.8, 0.3, 0.2, [1 ,0, 0], 0.1)\n# length, change length, start radius, end radius, direction, mesh size\n```\n* Smooth bends\n![bend](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/bend.png)\n```python\npiece = pieces.Curve(0.5, [1,0,-1], [0,1,0], 1, 0.2)\n# radius of cylinder, in direction, out direction, bend radius, mesh size\n```\n* Mitered bends\n![mitered](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/mitered.png)\n```python\npiece = pieces.Mitered(0.5, [0, 1, 0], [1, 0, 0], 0.2)\n# radius of cylinder, in direction, out direction, mesh size\n```\n* T Junctions\n![t_junc](https://raw.githubusercontent.com/Duncan-Hunter/pipemesh/master/pipemesh/images/t_junc.png)\n```python\npiece = pieces.TJunction(0.5, [1, 0, 0], [1, 1, -1], 0.1)\n# radius, direction, t direction, mesh size\n```\n\nThe mesh can be created and saved using:\n```python\nmesh.generate(3)\ngmsh.option.setNumber(\"Mesh.Binary\", 1) # 1 for binary, 0 for ASCII\ngmsh.write(filename.msh) # .msh2 for legacy format\n```\n\nTo view the mesh in the GMSH GUI, call\n```python\ngmsh.fltk.run()\n```\n\nTo finish, and end use of gmsh, call\n```python\ngmsh.finalize()\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Duncan-Hunter/pipemesh", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pipemesh", "package_url": "https://pypi.org/project/pipemesh/", "platform": "", "project_url": "https://pypi.org/project/pipemesh/", "project_urls": { "Homepage": "https://github.com/Duncan-Hunter/pipemesh" }, "release_url": "https://pypi.org/project/pipemesh/1.0/", "requires_dist": null, "requires_python": "", "summary": "A package for making pipe network meshes.", "version": "1.0" }, "last_serial": 5759504, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "f190418445d0d2951069d116f0cfd84d", "sha256": "80ff9826f838cad82e1f905f051b71d3c953dc2d48cdf487d8575432cae446ae" }, "downloads": -1, "filename": "pipemesh-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f190418445d0d2951069d116f0cfd84d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1068009, "upload_time": "2019-08-07T12:28:26", "url": "https://files.pythonhosted.org/packages/3c/64/52abe2e1c79fecf7108511d6f30a1d3cddc229a0c36fda3ffda005ce7bda/pipemesh-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c212542c058b411547e13b659ecabd9", "sha256": "7cd998fc202577e3a71ff6ad599f6ec79162870cc4812942a33167485191ecee" }, "downloads": -1, "filename": "pipemesh-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9c212542c058b411547e13b659ecabd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1054407, "upload_time": "2019-08-07T12:28:31", "url": "https://files.pythonhosted.org/packages/22/e0/8996c03cfff98039fdc64bcc5a2afacecf37746da21a505db5f8a7cf8d45/pipemesh-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "14b974addd1fdfd5e234ebba161f34d0", "sha256": "45cf1e1374057edb9d439825f1dfdb953733d1ca68dce0f157095ef743be120f" }, "downloads": -1, "filename": "pipemesh-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "14b974addd1fdfd5e234ebba161f34d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1067995, "upload_time": "2019-08-07T12:32:13", "url": "https://files.pythonhosted.org/packages/8f/b4/4b75237e26488b9a4e201a8cd07f9b50b62dfec32e9c5a2ce244a86c57b0/pipemesh-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45b3c3d768d7da965b808fef3a374fef", "sha256": "f9d67417473a80aaedd0c9e990421cc8a434fbf7e15eb8bd86b7908c7b8f7f9a" }, "downloads": -1, "filename": "pipemesh-0.1.3.tar.gz", "has_sig": false, "md5_digest": "45b3c3d768d7da965b808fef3a374fef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1054384, "upload_time": "2019-08-07T12:32:15", "url": "https://files.pythonhosted.org/packages/e9/25/0d3d3ebb0e85339849943035aad8d8b4df8048d872b035c0af1f59f00eaf/pipemesh-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "eca560be8e1e7b9d5959a16cf65faf33", "sha256": "4cd0996d9ad6c4dd22d04def40f07d3dbfe441becbf86c4bc20cc53875fb8144" }, "downloads": -1, "filename": "pipemesh-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "eca560be8e1e7b9d5959a16cf65faf33", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1109665, "upload_time": "2019-08-07T15:11:19", "url": "https://files.pythonhosted.org/packages/19/9d/a64bf14cbf9e0302c95d0fedc67051801db68e05f0bf8881ea4b55b338e3/pipemesh-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bda09bb9842f700f112e3b969fda78af", "sha256": "0a441b4a00c48e16b64a67b61185100c53769ef5d737981ca727507b4f5e903c" }, "downloads": -1, "filename": "pipemesh-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bda09bb9842f700f112e3b969fda78af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1096888, "upload_time": "2019-08-07T15:11:21", "url": "https://files.pythonhosted.org/packages/9d/29/71bcd73c184241d4602a982ee22fa39c6cbe910c829d6c60fa7fd180aba6/pipemesh-0.1.4.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "11b21be8f2e381f9feb5aa0812d07908", "sha256": "967c878970f1322131a75b9825cb08b805e277d5371f8a5101df4ed9f83fb223" }, "downloads": -1, "filename": "pipemesh-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "11b21be8f2e381f9feb5aa0812d07908", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1116734, "upload_time": "2019-08-16T16:08:18", "url": "https://files.pythonhosted.org/packages/48/9f/89124c74a580e0b864bc5f98685cfc19fa9896c1de85250e8fdebed1acba/pipemesh-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b2920f8cce7ec123cf0b06afae6f2f3", "sha256": "d08dc60e228a21b2aad1d030e3d07dd34d08a7f531259d7bd413a5a41e42ec26" }, "downloads": -1, "filename": "pipemesh-0.2.2.tar.gz", "has_sig": false, "md5_digest": "3b2920f8cce7ec123cf0b06afae6f2f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1103436, "upload_time": "2019-08-16T16:08:22", "url": "https://files.pythonhosted.org/packages/61/43/8104103e0e5c960b0c59829135f557a7bb615bb77eaa026534ccaaf0974a/pipemesh-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "e5982f604409b38e526ab51ca4c6892e", "sha256": "6752ab92d9b6772d8b0354d16f92399c261a58d91e6cc5f8488206795629f4b9" }, "downloads": -1, "filename": "pipemesh-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "e5982f604409b38e526ab51ca4c6892e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1117072, "upload_time": "2019-08-26T12:33:15", "url": "https://files.pythonhosted.org/packages/36/fe/96f772f7752ba043021d4142d0b137a04114855c89f12db6e79a0d0f253d/pipemesh-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "79df0c4fea50ead0c7f6254a7ad1ad42", "sha256": "6a169e18296e7e7f3e1f71ccc1569a24b0cb36e01a5f7ae42049714acef99732" }, "downloads": -1, "filename": "pipemesh-0.2.3.tar.gz", "has_sig": false, "md5_digest": "79df0c4fea50ead0c7f6254a7ad1ad42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1103793, "upload_time": "2019-08-26T12:33:17", "url": "https://files.pythonhosted.org/packages/0c/bd/0e6b66135c6eb56496ce353f139fc5d8fcd0d699fca328acb984f545275c/pipemesh-0.2.3.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "e85305a72536f2837501933eed308f3f", "sha256": "f3f70b7c9f17b7b83ea755323d9e54377d6f26e283dbd20be12adc522df3d5c4" }, "downloads": -1, "filename": "pipemesh-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e85305a72536f2837501933eed308f3f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1117296, "upload_time": "2019-08-30T10:05:19", "url": "https://files.pythonhosted.org/packages/d1/43/c522d60927b7dea3a0f54bdbe41b1073a73d0a10756c45ec206e0d00a88f/pipemesh-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45ef91ae10c2427162ed00403befc081", "sha256": "a9ad09eb9f24e7a0fc35428eb09771a17d73e92df74c5e1a66ca9286df5a31ee" }, "downloads": -1, "filename": "pipemesh-1.0.tar.gz", "has_sig": false, "md5_digest": "45ef91ae10c2427162ed00403befc081", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1104025, "upload_time": "2019-08-30T10:05:21", "url": "https://files.pythonhosted.org/packages/b3/a9/16081b0193f6196122453ec01019aa4c24893c57fce8ab329e4f4f4f5ea5/pipemesh-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e85305a72536f2837501933eed308f3f", "sha256": "f3f70b7c9f17b7b83ea755323d9e54377d6f26e283dbd20be12adc522df3d5c4" }, "downloads": -1, "filename": "pipemesh-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e85305a72536f2837501933eed308f3f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1117296, "upload_time": "2019-08-30T10:05:19", "url": "https://files.pythonhosted.org/packages/d1/43/c522d60927b7dea3a0f54bdbe41b1073a73d0a10756c45ec206e0d00a88f/pipemesh-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45ef91ae10c2427162ed00403befc081", "sha256": "a9ad09eb9f24e7a0fc35428eb09771a17d73e92df74c5e1a66ca9286df5a31ee" }, "downloads": -1, "filename": "pipemesh-1.0.tar.gz", "has_sig": false, "md5_digest": "45ef91ae10c2427162ed00403befc081", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1104025, "upload_time": "2019-08-30T10:05:21", "url": "https://files.pythonhosted.org/packages/b3/a9/16081b0193f6196122453ec01019aa4c24893c57fce8ab329e4f4f4f5ea5/pipemesh-1.0.tar.gz" } ] }