Skip to main content

Python Poisson solver on curvilinear 2-D grid

Project description


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.")
        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)
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 hashes)

Uploaded source

Built Distribution

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

Uploaded py3

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