Skip to main content

Interpolator of EM forces to mechanical meshes

Project description

Testing windows Testing linux PyPi version codecov

EM forces interpolator

Quickstart

em-interpolator is now on PyPi. You can simply install it using:

pip install em-interpolator

and upgraded it to the latest version with

pip install --upgrade em-interpolator

After that, start the GUI using:

python -m em_interp

N.B.
The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.

GUI overview and functionalities

The GUI is divided into two main tabs: the first is used to configure the interpoalation, while the second is used to perform the interpolation, export data and check results.

Configuration Tab

Three different paths must be indicated to run the interpolation:

  • EM folder: path to a folder containing the EM forces. These are .csv files (with or without header, various separators are accepted) that must contain the coordinates of the EM centroids (in meters) and the EM forces to be interpolated (in Newton). The GUI allows to indicate which is the index (starting from 0) of the X column and Fx column. Y, Z and Fy, Fz columns are expected to be placed respectively after the X column and Fx one. No other files should be present in this folder. More than one EM force file can be interpolated in the same run.
  • Mechanical Mesh: path to the .csv file describing the nodes of the mechanical mesh onto which forces have to be interpolated. The GUI allows to indicate the column index of the node number and the X coordinate (in meters). Y and Z coordinates columns are expected after the X one.
  • Output directory folder where all outputs of the interpolation will be stored.

In addition to these paths, the interpolation parameters described in the algorithm section must be set.

Interpolation Tab

The following is a description of the action buttons of the interpolation tab:

  • Run All: equivalent to clicking all buttons in sequence except for Preview Forces.
  • Initialize interpolator: builds the KDTree and pre-compute all the mech neighbours of each EM centroid.
  • Interpolate: performs the interpolation of all EM force files provided.
  • Export Checks: export a .csv containing forces and moments summaries of all interpolations.
  • Export ANSYS: export one force file for each interpolation ready to be used with the /INPUT command of APDL. The file has the format F, <node_ID>, Fx, <value>.
  • Compute VTK: build vtk objects for original and interpolated forces point clouds.
  • Export VTK: export the vtk objects to .vtk files.
  • Preview Forces: preview a comparison between original and interpolated EM forces to video in the GUI. Sliders are provided at the bottom of the pane to scale up or down the gliph arrows for better visibility purposes.

Description of available algorithms

The interpolation algorithm is based on K-Dimensional Trees (KDTree), a way to organize points in a K-dimensional space which grants fast querys.

KDTree neighbours

There are different ways to search for "close" points into a KDTree (i.e. neighbours). The following are the type of queries that are currently implemented here:

  • K-Nearest: select the K closest mech nodes to the EM node.
  • Radius: select all mech nodes contained by a sphere of radius R centered on the EM node.

Two additional parameters are provided independently of the neighbour selection strategy:

  • maximum distance cut-off: mech nodes farther than distance will be disregarded (more useful with k-nearest strategies).
  • coincidence tolerance: distance at which a mech node and em node should be considered coincident. In this case, no interpolation is called and the EM force is entirely assigned to the coincident mech node.

Interpolation kernels

Once the neighbours are found, there may be different ways to distribute the original EM force on the selected mechanical nodes. The following are the currently available interpolation kernels:

  • Weight by distance: distribute the forces invertionally proportional to the distance from the EM node.
  • FEM based: connect each mech node with a stiff beam to the EM node and distribute forces in order to have the same resultant force and a moment equal to zero.

Developer section

Developer install

First git clone the GitHub repository to your local hardware.

Create a fresh python environment using:

conda create -n <env_name> python=<python_version>

activate the new environment and install the package in editable mode and with additional dev dependencies:

pip install -e .[dev]

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

em_interpolator-0.1.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

em_interpolator-0.1.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file em_interpolator-0.1.0.tar.gz.

File metadata

  • Download URL: em_interpolator-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for em_interpolator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e4d9fe2c34d97a338d9a24c7455b927c29e324bad81ae9aac0c34620d4f0d300
MD5 9c0a780cac4bc15deac2e27cafaef8c9
BLAKE2b-256 b07b5a83e54950b5a3eb222de7ba6aefa3f6c3f8c8f0e38d48582978c27d993f

See more details on using hashes here.

Provenance

The following attestation bundles were made for em_interpolator-0.1.0.tar.gz:

Publisher: build_publish.yml on Fusion4Energy/EM-interpolator

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

File details

Details for the file em_interpolator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for em_interpolator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc2d0b5c3ac3eb9f2a29c5d406100cc3eb3e87dc35a8e5aa220a967fd7200b24
MD5 69bea894fcd780eb5aae58a99ceedc63
BLAKE2b-256 877fa42eb9f3be61a63718bb4fb71e0558898f8a76af9ea95ad5061e4d411412

See more details on using hashes here.

Provenance

The following attestation bundles were made for em_interpolator-0.1.0-py3-none-any.whl:

Publisher: build_publish.yml on Fusion4Energy/EM-interpolator

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