Skip to main content

Gap-averaged flow simulations with Gaussian Process regression.

Project description

Tests Coverage

GaPFlow

Gap-averaged flow simulations with Gaussian Process regression.

This code implements the solution of time-dependent lubrication problems as described in:

The extension to atomistic-continuum multiscale simulations with Gaussian process (GP) surrogate models has been described in:

The code uses µGrid for handling macroscale fields and tinygp as GP library. Molecular dynamics (MD) simulations run with LAMMPS through its Python interface. Elastic deformation is computed using ContactMechanics.

Installation

pip install GaPFlow

Building from source

When building from source follow these steps:

  1. Make sure you have MPI installed, e.g. on Debian-based systems openmpi-bin and libopenmpi-dev should be installed on your system.

  2. The multiscale framework depends on LAMMPS which is contained as a Git submodule in this repository. After cloning the repository initialize the submodule with

git submodule update --init
  1. Install LAMMPS and mpi4py. We provide a script to build LAMMPS via cmake and install the Python package in your local environment.
bash install_lammps.sh

Alternatively, follow the equivalent steps in the LAMMPS documentation with a complete list of build options. Make sure that you have the optional LAMMPS packages MANYBODY, MOLECULES and ÈXTRA-FIX installed. To make sure that everything is correctly installed run python .check_lammps.py. The last three lines should look similar to these:

MPI:  True
mpi4py:  True
Installed packages: ['EXTRA-FIX', 'MANYBODY', 'MOLECULE']
  1. Build µGrid's Python bindings
pip install -v --force-reinstall --no-cache --no-binary muGrid muGrid

and make sure MPI and PnetCDF get detected. For manual installations of PnetCDF (recommended), you may need to tell pkg_config where to find it, e.g.

export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$HOME/.local/lib64/pkgconfig:$PKG_CONFIG_PATH

for instalations under $HOME/.local/.

  1. Finally, install the package with its remaining dependencies and testing capabilities
pip install -e .[test]
  1. Make sure that everything works by running the tests with pytest.

Minimal example

Simulation inputs are commonly provided in YAML files. A typical input file might look like this:

# examples/journal.yaml
options:
    output: data/journal
    write_freq: 10
grid:
    dx: 1.e-5
    dy: 1.
    Nx: 100
    Ny: 1
    xE: ['D', 'N', 'N']
    xW: ['D', 'N', 'N']
    yS: ['P', 'P', 'P']
    yN: ['P', 'P', 'P']
    xE_D: 877.7007
    xW_D: 877.7007
geometry:
    type: journal
    CR: 1.e-2
    eps: 0.7
    U: 0.1
    V: 0.
numerics:
    tol: 1e-9
    dt: 1e-10
    max_it: 200
properties:
    shear: 0.0794
    bulk: 0.
    EOS: DH
    P0: 101325
    rho0: 877.7007
    T0: 323.15
    C1: 3.5e10
    C2: 1.23

Note that this example uses fixed-form constitutive laws without GP surrogate models or MD data. More example input files can be found in the examples directory.

The input files can be used to start a simulation from the command line

python -m GaPFlow -i my_input_file.yaml

or from a Python script

from GaPFlow.problem import Problem

myProblem = Problem.from_yaml('my_input_file.yaml')
myProblem.run()

Simulation output is stored under the location specified in the input file. After successful completion, you should find the following files.

  • config.yml: A sanitized version of your simulation input.
  • gap.nc: NetCDF file containing the gap height and gradients.
  • sol.nc: NetCDF file containing the solution and stress fields.
  • history.csv: Contains the time series of scalar quantities (step, Ekin, residual, ...)
  • gp_[xz,yz,zz].csv (Optional): Contains the time series of GP hyperparameters, database size, etc.
  • Xtrain.npy (Optional): Training data inputs
  • Ytrain.npy (Optional): Training data observations
  • Ytrain_err.npy (Optional): Training data observation error

The code comes with a few handy command line tools for visualizations like this one

journal

which shows the transient solution of a 1D journal bearing with active learning of the constitutive behavior.

Documentation

A Sphinx-generated documentation can be built locally with

cd doc
sphinx-apidoc -o . ../GaPFlow
make html

Funding

This work received funding from the German Research Foundation (DFG) through GRK 2450 and from the Alexander von Humboldt Foundation through a Feodor Lynen Fellowship.

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

gapflow-1.0.0rc4.tar.gz (64.1 kB view details)

Uploaded Source

Built Distribution

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

gapflow-1.0.0rc4-py3-none-any.whl (91.8 kB view details)

Uploaded Python 3

File details

Details for the file gapflow-1.0.0rc4.tar.gz.

File metadata

  • Download URL: gapflow-1.0.0rc4.tar.gz
  • Upload date:
  • Size: 64.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gapflow-1.0.0rc4.tar.gz
Algorithm Hash digest
SHA256 17416416f40e882307f7d447545874a636cc6bf40645186e07ff9db05dc2b18b
MD5 2f97c71ee08e2e59680e158dc7b16653
BLAKE2b-256 9b44a63e2cff1f723675025c678c442276305268e0f789ab3dca99547bd83c41

See more details on using hashes here.

Provenance

The following attestation bundles were made for gapflow-1.0.0rc4.tar.gz:

Publisher: ci.yaml on hannes-holey/GaPFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gapflow-1.0.0rc4-py3-none-any.whl.

File metadata

  • Download URL: gapflow-1.0.0rc4-py3-none-any.whl
  • Upload date:
  • Size: 91.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gapflow-1.0.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 798a45030ed4daca90c5b8009be346398e4baa65879240bf0dee98d63ecc683b
MD5 8c4119b2166b8ad6d4973013b6601d0a
BLAKE2b-256 c49935faac65afeffc621b3a401273717dc2968df8b05cfb0ba3304801a29c70

See more details on using hashes here.

Provenance

The following attestation bundles were made for gapflow-1.0.0rc4-py3-none-any.whl:

Publisher: ci.yaml on hannes-holey/GaPFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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