Metadata-Version: 2.4
Name: pyregen
Version: 0.1.0
Summary: A Python port of the NIST REGEN3.3 cryogenic regenerator model.
Author-email: Kishorekumar S <kishoresathishkumar@gmail.com>
Project-URL: Homepage, https://github.com/Kiesh628/pyRegen
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.20.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: CoolProp>=6.4.1

# pyregen

**pyregen** is a Python-based port of NIST **REGEN3.3** cryogenic regenerator model. 

It evaluates the fluid dynamics and heat transfer of oscillating helium flow through porous media at cryogenic temperatures. By replacing Fortran structures with a Object-Oriented Python architecture, `pyregen` acts as a fast, flexible engine.


## Installation

pip install pyregen

## Quick Start

`pyregen` is designed to act as a state-machine engine. You initialize the regenerator with your physical parameters, and then drive it forward in a loop.

```python
from pyregen import Regenerator

my_regen = Regenerator(
    gas_temp_cold=80.0,           # Cold end temperature (K)
    gas_temp_hot=300.0,           # Hot end temperature (K)
    herz=60.0,                    # Operating frequency (Hz)
    hydra_diam=50e-6,             # Hydraulic diameter (m)
    mass_flux_cold=0.01,          # Mass flux at cold end (kg/s)
    mass_flux_hot=0.01,           # Mass flux at hot end (kg/s)
    mass_phase=30.0,              # Phase shift (degrees)
    material='stainless steel',   # Matrix material
    porosity=0.68,                # Matrix porosity
    pres_initial=2.5e6,           # Average pressure (Pa)
    rg_area=0.002,                # Cross-sectional area (m^2)
    rg_length=0.05,               # Regenerator length (m)
    geometry='screens',           # Matrix geometry
    num_points_x=21,              # Number of spatial nodes
    num_steps_cyc=80              # Number of time steps per cycle
)

target_cycles = 10
total_steps = target_cycles * my_regen.num_steps_cyc

print(f"Starting Engine: Running {total_steps} steps...")

for step in range(total_steps):
    
    current_data = my_regen.advance()
    
    if (step + 1) % my_regen.num_steps_cyc == 0:
        print(f"Cycle {current_data['Cycle']:.1f} completed.")

full_history = my_regen.results()
final_gas_temp = full_history['Gas_Temperature'][-1, -1]
print(f"\nFinal Gas Temp at the cold boundary: {final_gas_temp:.2f} K")

my_regen.save_to_csv("my_simulation_run.csv")
```

## Supported Materials & Geometries

**Materials:**
* `stainless steel` (or `ss`)
* `lead` (or `pb`)
* `er3-ni` (or `er3ni`)
* *(More materials can be easily added via the `material_properties` function)*

**Geometries:**
* `parallel plates` (or `1`)
* `tubes` (or `2`)
* `screens` (or `4`)

## License

This project is licensed under the MIT License.
