mesh-generator


Namemesh-generator JSON
Version 1.1.11 PyPI version JSON
download
home_pagehttps://bitbucket.org/predsci/mesh_generator
SummaryPython subroutines to create a 1D mesh in Python.
upload_time2025-07-23 22:39:19
maintainerNone
docs_urlNone
authorPredictive Science Inc
requires_python>=3.5
licenseNone
keywords mesh generation grid
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This is a collection of Python subroutines and examples that illustrate how to build a
1D Mesh with custom mesh spacing. The meshes created in the package can be used for variety of applications, including
physical simulation.

## Installation
    
    pip install mesh-generator
    
## Dependencies
    python >= 3.5.0 
    numpy >= 1.15.2 
    matplotlib >= 3.0.0 
    scipy >= 1.1.0
    h5py >= 2.8.0 
    tk >= 8.6.0 
    pyhdf >= 0.9.10

## Usage
This an example for creating a 1D theta mesh. Read the comments inside the python scripts for more details.

- **Step 1** : Input mesh requirements. Make sure to specify:
    
    Mesh:
    
  - Set `lower_bnd` and `upper_bnd` limits of mesh.
  
  - Set `periodic`.
  
  - Set `DEFAULT_BG_REGION_RATIO` - Ratio in areas without ds constraint. (Optional)
  
  - Set `DEFAULT_FG_REGION_RATIO` - Ratio in areas with ds constraint. (Optional)
  
   Mesh segment:
    
  - Set `s0` and `s1` for segment domain limits.
  
  - Set `ds` to the resolution you want.
  
  - Set `var_ds_ratio` as segment maximum cell to cell mesh expansion ratio. (Optional)

```python 
from mesh_generator import Mesh
from mesh_generator import MeshSegment
from mesh_generator.bin.call_psi_mesh_tool import create_psi_mesh
import numpy 

# ratio in regions you do not care about. (Default is 1.06)
MeshSegment.DEFAULT_BG_REGION_RATIO = 1.06 

# ratio in regions you do care about. (Default is 1.03) 
MeshSegment.DEFAULT_FG_REGION_RATIO = 1.03  

# mesh boundaries and if periodic. 
mesh = Mesh(lower_bnd=0.00, upper_bnd=numpy.pi, periodic=False) 

# Mesh segment requirements:
# s0 - segment begin, s1- segment end, ds- mesh spacing
# (Optional) var_ds_ratio- the maximum ratio between each point in the mesh segment. 
mesh.insert_mesh_segment(MeshSegment(s0=1.10, s1=1.40, ds=0.01, var_ds_ratio=1.05))
mesh.insert_mesh_segment(MeshSegment(s0=1.30, s1=1.90, ds=0.02))
mesh.insert_mesh_segment(MeshSegment(s0=0.40, s1=2.80, ds=0.04, var_ds_ratio=1.02))
```  

- **Step 2**: Get final mesh and write results.      
        
```python 
input_mesh = mesh.json_dict()
adjusted_mesh = mesh.resolve_mesh_segments().json_dict()
legacy_mesh = mesh.build_legacy_mesh().json_dict()
create_psi_mesh(adjusted_mesh, legacy_mesh, mesh_type="t", dir_name=os.getcwd(),
     output_file_name="tmp_mesh_t.dat", mesh_res_file_name="mesh_res_t.dat",
     save_plot=True, show_plot=True, save_plot_path=os.getcwd(), plot_file_name="t_mesh_spacing.png", 
     input_mesh=input_mesh)
```

### Mesh Generator User Interface
```python
from mesh_generator import MeshGeneratorUI
MeshGeneratorUI()
```

## License
[Apache](http://www.apache.org/licenses/LICENSE-2.0)


## Authors
[Predictive Science Inc.](https://www.predsci.com/portal/home.php)

- Opal Issan (oissan@predsci.com)
- Cooper Downs (cdowns@predsci.com)









            

Raw data

            {
    "_id": null,
    "home_page": "https://bitbucket.org/predsci/mesh_generator",
    "name": "mesh-generator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "Mesh Generation, Grid",
    "author": "Predictive Science Inc",
    "author_email": "oissan@predsci.com",
    "download_url": "https://files.pythonhosted.org/packages/62/72/e7d44127654d11e3626d09e3715c4629b2e6a3c1b73c50b3f55aff9a947d/mesh_generator-1.1.11.tar.gz",
    "platform": null,
    "description": "This is a collection of Python subroutines and examples that illustrate how to build a\n1D Mesh with custom mesh spacing. The meshes created in the package can be used for variety of applications, including\nphysical simulation.\n\n## Installation\n    \n    pip install mesh-generator\n    \n## Dependencies\n    python >= 3.5.0 \n    numpy >= 1.15.2 \n    matplotlib >= 3.0.0 \n    scipy >= 1.1.0\n    h5py >= 2.8.0 \n    tk >= 8.6.0 \n    pyhdf >= 0.9.10\n\n## Usage\nThis an example for creating a 1D theta mesh. Read the comments inside the python scripts for more details.\n\n- **Step 1** : Input mesh requirements. Make sure to specify:\n    \n    Mesh:\n    \n  - Set `lower_bnd` and `upper_bnd` limits of mesh.\n  \n  - Set `periodic`.\n  \n  - Set `DEFAULT_BG_REGION_RATIO` - Ratio in areas without ds constraint. (Optional)\n  \n  - Set `DEFAULT_FG_REGION_RATIO` - Ratio in areas with ds constraint. (Optional)\n  \n   Mesh segment:\n    \n  - Set `s0` and `s1` for segment domain limits.\n  \n  - Set `ds` to the resolution you want.\n  \n  - Set `var_ds_ratio` as segment maximum cell to cell mesh expansion ratio. (Optional)\n\n```python \nfrom mesh_generator import Mesh\nfrom mesh_generator import MeshSegment\nfrom mesh_generator.bin.call_psi_mesh_tool import create_psi_mesh\nimport numpy \n\n# ratio in regions you do not care about. (Default is 1.06)\nMeshSegment.DEFAULT_BG_REGION_RATIO = 1.06 \n\n# ratio in regions you do care about. (Default is 1.03) \nMeshSegment.DEFAULT_FG_REGION_RATIO = 1.03  \n\n# mesh boundaries and if periodic. \nmesh = Mesh(lower_bnd=0.00, upper_bnd=numpy.pi, periodic=False) \n\n# Mesh segment requirements:\n# s0 - segment begin, s1- segment end, ds- mesh spacing\n# (Optional) var_ds_ratio- the maximum ratio between each point in the mesh segment. \nmesh.insert_mesh_segment(MeshSegment(s0=1.10, s1=1.40, ds=0.01, var_ds_ratio=1.05))\nmesh.insert_mesh_segment(MeshSegment(s0=1.30, s1=1.90, ds=0.02))\nmesh.insert_mesh_segment(MeshSegment(s0=0.40, s1=2.80, ds=0.04, var_ds_ratio=1.02))\n```  \n\n- **Step 2**: Get final mesh and write results.      \n        \n```python \ninput_mesh = mesh.json_dict()\nadjusted_mesh = mesh.resolve_mesh_segments().json_dict()\nlegacy_mesh = mesh.build_legacy_mesh().json_dict()\ncreate_psi_mesh(adjusted_mesh, legacy_mesh, mesh_type=\"t\", dir_name=os.getcwd(),\n     output_file_name=\"tmp_mesh_t.dat\", mesh_res_file_name=\"mesh_res_t.dat\",\n     save_plot=True, show_plot=True, save_plot_path=os.getcwd(), plot_file_name=\"t_mesh_spacing.png\", \n     input_mesh=input_mesh)\n```\n\n### Mesh Generator User Interface\n```python\nfrom mesh_generator import MeshGeneratorUI\nMeshGeneratorUI()\n```\n\n## License\n[Apache](http://www.apache.org/licenses/LICENSE-2.0)\n\n\n## Authors\n[Predictive Science Inc.](https://www.predsci.com/portal/home.php)\n\n- Opal Issan (oissan@predsci.com)\n- Cooper Downs (cdowns@predsci.com)\n\n\n\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python subroutines to create a 1D mesh in Python.",
    "version": "1.1.11",
    "project_urls": {
        "Homepage": "https://bitbucket.org/predsci/mesh_generator"
    },
    "split_keywords": [
        "mesh generation",
        " grid"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1113e8f93fcfb6bfc20b777d0c497e0cec6acb70b4df3445a6380c12c5729d5",
                "md5": "7bc9358201393e74e54d55279c647cbc",
                "sha256": "c646634d6402f4016162b125d6ee767cacbbbf6629e1bfc1e40ef77089b445c2"
            },
            "downloads": -1,
            "filename": "mesh_generator-1.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7bc9358201393e74e54d55279c647cbc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 66890,
            "upload_time": "2025-07-23T22:39:18",
            "upload_time_iso_8601": "2025-07-23T22:39:18.112458Z",
            "url": "https://files.pythonhosted.org/packages/c1/11/3e8f93fcfb6bfc20b777d0c497e0cec6acb70b4df3445a6380c12c5729d5/mesh_generator-1.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6272e7d44127654d11e3626d09e3715c4629b2e6a3c1b73c50b3f55aff9a947d",
                "md5": "4492c6c0c6e3638c9ccf1d97a485daaa",
                "sha256": "cdbb1da6989bd57138c0a53c050d1abb1a64f645917fc4817503a48b25fa6a5e"
            },
            "downloads": -1,
            "filename": "mesh_generator-1.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "4492c6c0c6e3638c9ccf1d97a485daaa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 75007,
            "upload_time": "2025-07-23T22:39:19",
            "upload_time_iso_8601": "2025-07-23T22:39:19.020833Z",
            "url": "https://files.pythonhosted.org/packages/62/72/e7d44127654d11e3626d09e3715c4629b2e6a3c1b73c50b3f55aff9a947d/mesh_generator-1.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-23 22:39:19",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "predsci",
    "bitbucket_project": "mesh_generator",
    "lcname": "mesh-generator"
}
        
Elapsed time: 1.38966s