Aggregate Y-Stress

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
from lasso.dyna import ArrayType
from mesh2vec.mesh2vec_cae import Mesh2VecCae

Load Shell from ANSA, simulation results from d3plot

hg = Mesh2VecCae.from_ansa_shell(
    10,
    Path("../../data/hat/Hatprofile.k"),
    json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
)


def mean_over_components_all_layers(v):
    """get mean over all components and all layers"""
    return np.mean(v, axis=-1)


fature_name = hg.add_feature_from_d3plot(
    ArrayType.element_shell_stress,
    Path("../../data/hat/HAT.d3plot"),
    timestep=-1,
    shell_layer=mean_over_components_all_layers,
)

Aggregate Feature and plot

name = hg.aggregate(fature_name, 1, lambda x: np.mean(np.mean(x)))
fig = hg.get_visualization_plotly(str(name))
fig.update_layout(title=name)
fig


Access the results

hg.to_dataframe()
vtx_id element_shell_stress_-1_mean_over_components_all_layers-<lambda>-1
0 4700000 -0.003867
1 4700001 -0.003714
2 4700002 0.000849
3 4700003 -0.005308
4 4700004 -0.007338
... ... ...
6395 2002173 -0.000210
6396 2002174 -0.000232
6397 2002175 0.000439
6398 2002176 -0.000076
6399 2002177 -0.000093

6400 rows × 2 columns



Total running time of the script: ( 0 minutes 1.491 seconds)

Gallery generated by Sphinx-Gallery