Skip to main content

Python Poisson solver on curvilinear 2-D grid

Project description

Calcifer

Under construction

Calcifer is a Poisson-like PDE finite difference solver on 2-D structured I.J Grids. Grids are curvilinear.

  • create a Geometry object.
  • define the computational Domain, based upon this Geometry.
  • Solve the problem. Heat conduction is solver in HeatSolve from Calcifer.

Thermal diffusion, solver by calcifer.

A thermal diffusion test with calcifer is done like this:

from calcifer_pde.domain import Domain
from calcifer_pde.geometry import Square

def heat_solve(dom, k_coeff=1.0):
    init_field = np.random.random_sample(dom.shp1d)
    sterm_l = np.zeros_like(dom.lapl)
    sterm_r = np.zeros(dom.shp1d)
    # Left Hand Side
    lhs_csr = dom.lapl * k_coeff + sterm_l
    # Right-Hand Side
    rhs_csr = np.zeros(dom.shp1d) + sterm_r
    lhs_csr_bc, rhs_csr_bc, grad_n_bc = apply_bc(dom, lhs_csr, rhs_csr)

    out_1d, info = scp.linalg.bicgstab(lhs_csr_bc, rhs_csr_bc, x0=init_field)
    if info == 0:
        print(".   ^_^ Resolution succesfull.")
    elif info > 0:
        print(".   t(-_-t) Resolution failed.")
    else:
        print(".   =_= Convergence not reached.")
    temp = out_1d.reshape(dom.shp2d)
    return temp

geo = Square(nx=80, ny=100, len_x=1.0, len_y=1.0)
dom = Domain(geo)
dom.switch_bc_vmax_neuman(0.0)
dom.switch_bc_vmin_neuman(0.0)
dom.switch_bc_umin_dirichlet(200.0)
dom.switch_bc_umax_dirichlet(100.0)
sol = heat_solve(dom, k_coeff=22.0)

One can solve an other PDE by creating a different problem than heat solve

Project details


Download files

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

Source Distribution

calcifer_pde-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

calcifer_pde-0.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file calcifer_pde-0.1.1.tar.gz.

File metadata

  • Download URL: calcifer_pde-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.5

File hashes

Hashes for calcifer_pde-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b6513526347d213437ec348b3bd452564228321619590bb25a5b55e901d9db84
MD5 74d23fa17319b71d31f8e864be8899e8
BLAKE2b-256 3b18689bec49a34ed412655714fd944963ff4ca25d7564f5440b8f2349f07b5d

See more details on using hashes here.

File details

Details for the file calcifer_pde-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: calcifer_pde-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.5

File hashes

Hashes for calcifer_pde-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce7496953616a1cb234307b43fb18390f5a13a8b16e541da1ae58c580f47b745
MD5 ca48adc46ff7d857f766dfb868a5d0ce
BLAKE2b-256 d785b8df1796fe41266df5a0ac9d15555c59021eded6f9b2c288874d2b306105

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