Mesh

Mesh definition

Saenopy uses only thetrahedral meshes. The mesh is defined by the N nodes and by the connectivity of the nodes by M thetrahedra.

Text files

Nodes are an Nx3 float array (three spatial dimensions). Units are in meters.

Nodes can be loaded from a .txt file structured like this

nodes.txt
10e-6 0e-6 0e-6
20e-6 1e-6 0e-6
31e-6 1e-6 0e-6
41e-6 0e-6 0e-6
50e-6 0e-6 1e-6
60e-6 1e-6 1e-6
71e-6 1e-6 1e-6
81e-6 0e-6 1e-6

Connectivity is an Mx4 integer array (reference the node indices of the 4 corners).

The connectivity can be loaded from a .txt file structured like this

connectivity.txt
10 1 3 5
21 2 3 5
30 5 3 4
44 5 3 7
55 2 3 6
63 5 6 7

Both can be loaded using np.loadtxt and added to the solver using setNodes() and setTetrahedra().

1import numpy as np
2from saenopy import Solver
3
4# initialize the solver
5M = Solver()
6# load the nodes (units in meters)
7M.setNodes(np.loadtxt("nodes.txt"))
8# load the connectivity
9M.setTetrahedra(np.loadtxt("connectivity.txt"))

Gmsh file

If the mesh was created in gmsh, saenopy provides a loader to directly load files of the Gmsh format.

1from saenopy import load
2
3# load gmsh file and return a solver object with the mesh
4M = load.load_gmsh("mesh.msh")

Defining Inputs

Boundary Conditions

For using the Boundary Condition Mode, constraints for displacement (Nx3 array) and force (Nx3 array) have to be provided. For each node, either a displacement or a force needs to be given, the other has to be nan.

  • For a fixed node
    • the displacement should be provided (3 float values, in meters)

    • the force should left open (3 nan values)

  • For a free node,
    • the displacement should be left open (3 nan values)

    • the force should provided (3 float values, in Newtons).

constraint_displacement.txt
10. 0. 0.
20. 0. 0.
3nan nan nan
4nan nan nan
50. 0. 0.
60. 0. 0.
7nan nan nan
8nan nan nan
constraint_force.txt
1nan      nan nan
2nan      nan nan
3-2.5e-12 0.  0.
4-2.5e-12 0.  0.
5nan      nan nan
6nan      nan nan
7-2.5e-12 0.  0.
8-2.5e-12 0.  0.

Both can be loaded using np.loadtxt and added to the solver using setBoundaryCondition().

1# load the displacement constraints (in meters)
2node_displacement = np.loadtxt("constraint_displacement.txt")
3# load the force constraints (in Newton)
4node_force = np.loadtxt("constraint_force.txt")
5# hand the boundary conditions to the solver
6M.setBoundaryCondition(node_displacement, node_force)

Measured displacement

For using Regularization Mode, the measured (or target) displacement (Nx3 array, in meters) has to be provided for all nodes.

measured_displacement.txt
10       0 0
20       0 0
30.01e-6 0 0
40.01e-6 0 0
50       0 0
60.01e-6 0 0
70.01e-6 0 0
80       0 0

It can be loaded using np.loadtxt and added to the solver using setTargetDisplacements().

1node_displacement = np.loadtxt("measured_displacement.txt")
2M.setTargetDisplacements(node_displacement)