Skip to content

kinnala/ngsimple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngsimple

PyPI

Suppose you wanted to use Netgen in a Python script to generate tetrahedral meshes but did not want to spend time installing the entire Netgen/NGSolve package which ships with it's own Python interpreter. This is a simple wrapper for running Netgen mesh generator inside a container and functions for calling it transparently from any Python interpreter.

This is work-in-progress. Currently using the following container: https://hub.docker.com/r/ngsxfem/ngsolve. In future, plan is to use a dedicated more lightweight container.

Installation

Install with

pip install ngsimple

ngsimple requires Docker and docker-py for pulling container images and interacting with the mesh generator. The output mesh is read back to Python using meshio.

Example

from ngsimple import generate

mesh = generate("""algebraic3d

solid main = sphere (0, 0, 0; 1);

tlo main;
point (0, 0, 0);
""", verbose=True)

from vedo import show

show(mesh)

Netgen output mesh

Changelog

0.2.0

  • Update to a working container image
  • Allow specifying image and tag in generate