CubeFlow
- abstract:
CubeFlow is a Python framework to easily build and analyse grid based simulation such as heat transportation or fluid dynamics. CubeFlow aims to provide an easy implementation without the need of writing code other than the one needed for the actual simulation. CubeFlow is not a super fast simulator but focuses primarily on educational purposes.
Code Sample
The following code generates a simple heat flow simulator of a homogeneous cube.
from typing import Dict, Sequence
from cubeflow.cell import MetaCell, Scalar
from cubeflow.cube import CubeGrid
from cubeflow.simulator import BaseSimulator, add_derivations, border_handler
from cubeflow.report.csv import CSVReport
from cubeflow.predicates.counter import Counter
class HeatCell(metaclass=MetaCell):
temperature = Scalar()
diffusivity = Scalar()
flow = 0.0
@add_derivations
class HeatSimulator(BaseSimulator[HeatCell]):
Type = HeatCell
@border_handler(1)
def no_flow_border(self, cells: Dict[Sequence[int], HeatCell]) -> HeatCell:
cell = cells[(0, 0)]
adjacent = self._get_adjacent_inner(cells)
if adjacent:
# cell is not a corner
cell.temperature = self._get_only_cell(adjacent)[1].temperature
return cell
else:
return self._handle_corner(cells)
def _prepare(self, cells: Dict[Sequence[int], HeatCell]) -> HeatCell:
cell = cells[(0, 0)]
cell.flow = cell.diffusivity * self.laplace_temperature(cells)
return cell
def _simulate(self, cells: Dict[Sequence[int], HeatCell]) -> HeatCell:
cell = cells[(0, 0)]
cell.temperature += self.dt * cell.flow
return cell
if __name__ == '__main__':
from sys import argv
simulator = HeatSimulator(CubeGrid.from_file(argv[1], HeatCell), [CSVReport('heat')])
simulator.simulate_while(Counter(1000))
Changes
0.17 Added grid specification support via toml like textfile.
Roadmap
0.18 Improved examples and documentation. Adding flow based simulation in contrast to the existing “computational” approach, meaning defining the simulation in terms of data flows between cells.
0.19 Improved output format, browser application to create grids in a graphical and interactive way.
0.20 Translation support for CubeFlow projects to either Stackless Python or Rust.
Metadata
Release files for CubeFlow 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CubeFlow-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Release files / CubeFlow-0.1.7-py3-none-any.whl
| Download URL | CubeFlow-0.1.7-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
287afce87e5330281fd1ed3d07de4652a886effc188be99026586106d2f2faf5
|
|
BLAKE2b-256 checksum How to use checksums |
7490bc35c2412420cbfd0f10251904032609e6637064435051de7991c22e1a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for CubeFlow 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.