Interpolator of EM forces to mechanical meshes
Project description
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
Xcolumn andFxcolumn.Y,ZandFy,Fzcolumns are expected to be placed respectively after theXcolumn andFxone. 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 numberand theXcoordinate (in meters).YandZcoordinates columns are expected after theXone. - 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
/INPUTcommand of APDL. The file has the formatF, <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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4d9fe2c34d97a338d9a24c7455b927c29e324bad81ae9aac0c34620d4f0d300
|
|
| MD5 |
9c0a780cac4bc15deac2e27cafaef8c9
|
|
| BLAKE2b-256 |
b07b5a83e54950b5a3eb222de7ba6aefa3f6c3f8c8f0e38d48582978c27d993f
|
Provenance
The following attestation bundles were made for em_interpolator-0.1.0.tar.gz:
Publisher:
build_publish.yml on Fusion4Energy/EM-interpolator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
em_interpolator-0.1.0.tar.gz -
Subject digest:
e4d9fe2c34d97a338d9a24c7455b927c29e324bad81ae9aac0c34620d4f0d300 - Sigstore transparency entry: 940559786
- Sigstore integration time:
-
Permalink:
Fusion4Energy/EM-interpolator@6ada76239d57bffed942268ed49c55c2d5d811cd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Fusion4Energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_publish.yml@6ada76239d57bffed942268ed49c55c2d5d811cd -
Trigger Event:
release
-
Statement type:
File details
Details for the file em_interpolator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: em_interpolator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc2d0b5c3ac3eb9f2a29c5d406100cc3eb3e87dc35a8e5aa220a967fd7200b24
|
|
| MD5 |
69bea894fcd780eb5aae58a99ceedc63
|
|
| BLAKE2b-256 |
877fa42eb9f3be61a63718bb4fb71e0558898f8a76af9ea95ad5061e4d411412
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
em_interpolator-0.1.0-py3-none-any.whl -
Subject digest:
bc2d0b5c3ac3eb9f2a29c5d406100cc3eb3e87dc35a8e5aa220a967fd7200b24 - Sigstore transparency entry: 940559789
- Sigstore integration time:
-
Permalink:
Fusion4Energy/EM-interpolator@6ada76239d57bffed942268ed49c55c2d5d811cd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Fusion4Energy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_publish.yml@6ada76239d57bffed942268ed49c55c2d5d811cd -
Trigger Event:
release
-
Statement type: