Skip to content
Commits on Source (3)
# Python implementation
The Python implementation utilizes NumPy and mpi4py for computation and
communication, as well as matplotlib for outputting images. The main program
is implemented in [heat.py](heat.py), and the whole program can be executed as
mpirun -np xxx python heat.py
## Using Cython kernel
By default, the code uses pure NumPy for evaluating the time evolution
step. In addition, a Cython version for the main computational kernels
is provided in [evolve.pyx](evolve.pyx). The Cython kernels can be built
into Python extension in current directory with
python setup.py build_ext --inplace
After building the Cython kernels main program can be executed as previously.
......@@ -8,8 +8,8 @@ from heat_io import read_restart, read_field
def initialize():
timesteps = 500 # Number of time-steps to evolve system
nx = 1000
ny = 1000
nx = 2000
ny = 2000
if isfile('HEAT_RESTART.dat'):
field, field0, parallel, iter0 = read_restart()
......@@ -31,7 +31,7 @@ def initialize():
iter0 = 0
return field, field0, parallel, iter0, timesteps
return field, parallel, iter0, timesteps
def generate_field(nx, ny):
......