Skip to main content

Python implementation of the MGRIT algorithm

Project description

Test Status Lint Status Docs Status Publish Status

Installation

PyMGRIT requires mpicc (from openmpi or mpich)

>>> pip install pymgrit

or

>>> python setup.py install

Introduction

PyMGRIT is a library for the Multigrid-Reduction-in-Time (MGRIT) algorithm in Python

Getting Help

For documentation see https://pymgrit.github.io/pymgrit/

Create an issue.

Look at the Quickstart or the Examples.

What is MGRIT?

To be done.

PyMGRIT Features

  • Classical Multigrid-Reduction-in-Time (MGRIT)

  • Additional coarsening in space

Example Usage

PyMGRIT is easy to use! The following code constructs a 1-d heat equation example and solves the resulting space-time system of equations with MGRIT:

import pymgrit
heat_lvl_0 = pymgrit.HeatEquation(x_start=0, x_end=2, nx=1001, d=1, t_start=0, t_stop=2, nt=65)
heat_lvl_1 = pymgrit.HeatEquation(x_start=0, x_end=2, nx=1001, d=1, t_start=0, t_stop=2, nt=17)
heat_lvl_2 = pymgrit.HeatEquation(x_start=0, x_end=2, nx=1001, d=1, t_start=0, t_stop=2, nt=5)
problem = [heat_lvl_0, heat_lvl_1, heat_lvl_2]
mgrit = pymgrit.Mgrit(problem=problem, tol=1e-10)
sol = mgrit.solve()

Program output:

INFO - 23-01-20 11:48:53 - Start setup
INFO - 23-01-20 11:48:53 - Setup took 0.1085507869720459 s
INFO - 23-01-20 11:48:54 - Start solve
INFO - 23-01-20 11:48:54 - iter 1  | con: 0.010531208413419799   | con-fac: -                       | runtime: 0.21976184844970703 s
INFO - 23-01-20 11:48:55 - iter 2  | con: 0.0006683816775940518  | con-fac: 0.06346676006737657     | runtime: 0.15288186073303223 s
INFO - 23-01-20 11:48:55 - iter 3  | con: 4.0050232837502924e-05 | con-fac: 0.05992120098454857     | runtime: 0.12258291244506836 s
INFO - 23-01-20 11:48:55 - iter 4  | con: 2.0920119846420314e-06 | con-fac: 0.052234702183381       | runtime: 0.13314509391784668 s
INFO - 23-01-20 11:48:55 - iter 5  | con: 8.482152793325008e-08  | con-fac: 0.040545431171496886    | runtime: 0.13439655303955078 s
INFO - 23-01-20 11:48:55 - iter 6  | con: 2.120708067856101e-09  | con-fac: 0.025002002669946982    | runtime: 0.12366461753845215 s
INFO - 23-01-20 11:48:55 - iter 7  | con: 2.003907620345022e-11  | con-fac: 0.009449238444077046    | runtime: 0.15373992919921875 s
INFO - 23-01-20 11:48:55 - Solve took 1.1199557781219482 s
INFO - 23-01-20 11:48:55 - Run parameter overview

interval                  : [0.0, 2.0]
number points             : 65 points
max dt                    : 0.03125
level                     : 3
coarsening                : [4, 4]
cf_iter                   : 1
nested iteration          : True
cycle type                : V
stopping tolerance        : 1e-10
communicator size time    : 1
communicator size space   : -99

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

pymgrit-0.1.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymgrit-0.1.1-py3-none-any.whl (62.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymgrit-0.1.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pymgrit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 956f30a90f7154d28f479b9f180583097b020818e8f767adf9e3c6a169656f50
MD5 2bdfc696f4bb402dbda07fb09b1d320c
BLAKE2b-256 244b8b686e3db9d345d430b2b9b275949e83b32d49804179d43fec5bd14ce8b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymgrit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 62.2 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/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for pymgrit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d91746bdb341066b2a51974d5509f7fb2eadfbdea457b4b32fd88d98f691249
MD5 8bcbe595c821ffc6570d29e4b3868467
BLAKE2b-256 f6018b9790e59b40d3070cb2cca6d7ae6f4571444c7723d611d4cd3222f1b3f2

See more details on using hashes here.

Supported by

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