This repository stores runnable Python examples for polyfem-python.
It is intended to be checked out as the examples/ submodule inside
polyfem-python:
git submodule update --init --recursive examplesclassic_example/2D/: 2D generated-API examples.classic_example/3D/: 3D generated-API examples.
These examples import:
from polyfempy.runtime import solve
from polyfempy.generated_api import generated_api as polyfemThey also read source JSON files and meshes from polyfem-data/contact.
By default, the helper scripts look for a sibling polyfem-data checkout:
- inside
polyfem-python/examples, this resolves topolyfem-python/polyfem-data; - in a standalone
python_datacheckout, this resolves topolyfem-datanext topython_data.
To use a different location, set:
export POLYFEM_DATA_ROOT=/path/to/polyfem-dataOn PowerShell:
$env:POLYFEM_DATA_ROOT = "C:\path\to\polyfem-data"From this repository root:
python classic_example/2D/contact_2d_golf_ball_generated_api.pyFrom the parent polyfem-python repository root:
python examples/classic_example/2D/contact_2d_golf_ball_generated_api.pyExample outputs are written under the corresponding *_examples_outputs/
directory and are ignored by Git.