Metadata-Version: 2.1
Name: mesh-generator
Version: 1.0.7
Summary: Python subroutines to create a 1D mesh in Python.
Home-page: https://bitbucket.org/predsci/mesh_generator
Author: Predictive Science Inc
Author-email: oissan@predsci.com
License: UNKNOWN
Keywords: Mesh Generation,Grid
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.5
Description-Content-Type: text/markdown
Requires-Dist: numpy (>=1.15.2)
Requires-Dist: matplotlib (>=3.0.0)

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
    numpy>=1.15.2 # Minimum version 1.18.1
    matplotlib>=3.0.0 # Minimum version 3.1.3
    python>=3.5.0 # Minimum version 3.5

## 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
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 save it as a dictionary.      

```python 
mesh.resolve_mesh_segments()
mesh.build_legacy_mesh()
mesh.json_dict() #returns the final discretized mesh.
```


## 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)










