Skip to main content

Python package for solving implicit heat conduction

Project description

Conduction

Implicit heat conduction solver on a structured grid written in Python. It interfaces with PETSc to provide highly scalable meshes and solve the steady-state heat equation using direct or iterative methods.

Dependencies

  • Python 2.7 and above
  • Numpy 1.9 and above
  • Scipy 0.14 and above
  • mpi4py
  • petsc4py
  • h5py (optional - for saving parallel data)
  • Matplotlib (optional - for visualisation)

PETSc installation

PETSc is used extensively via the Python frontend, petsc4py. It is required that PETSc be configured and installed on your local machine prior to using this module. You can use pip to install petsc4py and its dependencies.

pip install [--user] numpy mpi4py
pip install [--user] petsc petsc4py

If that fails, you must compile these dependencies manually.

Usage

All of the scripts in the tests directory can be run in parallel, e.g.

mpirun -np 4 python conduction3d_benchmark.py

where the number after the np flag specifies the number of processors.

API

A ConductionND object can be defined based on the extent of the domain and the number of cells. The simplified use-case below outlines the following tasks:

  1. Define a mesh on which to solve the heat equation
  2. Populate the thermal conductivity and heat production fields
  3. Set boundary conditions on the top and bottom walls
  4. Solve for temperature
from conduction import ConductionND

# define the mesh
minX, minY, minZ = 0.0, 0.0, 0.0
maxX, maxY, maxZ = 1.0, 1.0, 1.0
resX, resY, resZ = 10, 10, 10

mesh = ConductionND((minX, minY, minZ), (maxX, maxY, maxZ), (resX, resY, resZ))

# populate thermal conductivity and heat production fields
n = resX*resY*resZ
k = np.ones(n)
H = np.ones(n)

mesh.update_properties(k, H)

# set boundary conditions
mesh.boundary_condition("maxZ", 0.0, flux=False) # Dirichlet BC
mesh.boundary_condition("minZ", 1.0, flux=True) # Neumann BC

# solve temperature
T = mesh.solve()

More complex examples can be found in the Examples directory.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conduction-0.1.tar.gz (315.8 kB view details)

Uploaded Source

File details

Details for the file conduction-0.1.tar.gz.

File metadata

  • Download URL: conduction-0.1.tar.gz
  • Upload date:
  • Size: 315.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

File hashes

Hashes for conduction-0.1.tar.gz
Algorithm Hash digest
SHA256 ba3d82ba5570c53fbd6e9496d06ffb59aafcc2dde99591cd9e3dceeca3d8df25
MD5 ac1e996d07667389f3283d8af96111e1
BLAKE2b-256 0da0db2e682842ad0449869199b9cab5f09d4a2407622897e600131fc35e9eb3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page