Can python boundary conditions access mesh nodes?

Hi Everyone,

is it possible to access mesh node information when using a python BC? Thanks.



Hi Carlos,

the mesh is not directly accessible in the Python BC. If you need data from the mesh you’d need to open the mesh in the Python script manually, e.g. via PyVista. But that’s probably pretty fragile. E.g., it will be easy to open the wrong mesh in the Python script if you change the meshes in the prj file.

Furthermore, the node_id is passed only to the getDirichletBCValue() method. Natural BCs are not evaluated on mesh nodes, but on the integration points of the boundary element’s surfaces, therefore there is no node_id information for natural BCs.

Depending on what you want to achieve, there might be other solutions…