semvec/pypi-packages huggingface dataset:
dune 2.8.0.dev7052021
Distributed and Unified Numerics Environment
Requires Python: >=3.7

DUNE
====

DUNE, the Distributed and Unified Numerics Environment, is a modular toolbox for solving partial differential equations with grid-based methods.


Installation
------------

Requirements:
 - Python 3.7 or later
 - C++ compiler (at least C++17 compatible)
 - pkg-config
 - MPI (optional)


Activate a virtual environment (strongly recommended):

````
python -m venv dune-env
source dune-env/bin/activate
````

Download and build Dune and its dependencies from PyPI:

````
pip install dune
````

Note that this takes some time in order to compile all dependent Dune modules.



Basic Usage
-----------

Some short code examples.

__Example 1: Grid creation__
````
from dune.grid import structuredGrid
grid = structuredGrid([0,0], [1,1], [10, 10])
grid.plot()
````

__Example 2: The Dune grid interface__
````
from dune.common import FieldVector
f = lambda x: FieldVector([x[0]**2, x[1]**2])
divf = 0
for element in grid.elements:
  for intersection in grid.intersections(element):
    igeo = intersection.geometry
    divf += igeo.volume * (intersection.unitOuterNormal(0.5) * f(igeo.center))

print(divf)
````

__Example 3: Poisson problem__
````
from ufl import *
from dune.fem.space import lagrange
from dune.fem.scheme import galerkin
from dune.ufl import DirichletBC

space = lagrange(grid, order=1)
u, v = TrialFunction(space), TestFunction(space)

a = inner(grad(u), grad(v)) * dx
b = 1 * v * dx

scheme = galerkin([a == b, DirichletBC(space, 0)])
uh = space.interpolate(0, name="uh")
scheme.solve(uh)
uh.plot()
````


License
-------

DUNE is licensed under version 2 of the GNU General Public License, with the so-called "runtime exception".