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?

TODO

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymgrit-0.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-py3-none-any.whl
Algorithm Hash digest
SHA256 9886541c85de96ec7a1d302cbf13f35d22fd67e29ef6dc06b100d4a901744ea9
MD5 620e8e39a3c76897d47efe7c030a1c5e
BLAKE2b-256 f9b010bb7f80b5f2693bf4243354811650c4791a7398ef16b5e36c1b5ecf1e6c

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