Data-driven solver for truss structures¶
-
class
ddtruss.
Truss
(points, lines)¶ Simple static equilibrium solver for truss structures
Parameters: - points (ndarray, shape (n_points, dim)) – Point coordinates with spatial dimension
dim
- lines (ndarray, shape (n_lines, 2)) – Connectivity of bars
-
integrate
(fun)¶ Integrate a function defined on bars
Parameters: fun (ndarray, shape (n_lines, ..)) – Function to be integrated
-
solve
(A=1, E=1, U_dict={}, F_dict={}, sig0=None, construct_K=False)¶ Solve the static equilibrium problem for the truss structure
Parameters: - A (float or ndarray, shape (n_lines, )) – Cross section area
- E (float) – Young’s modulus
- U_dict (dict) – Prescribed displacement
{point_id: (Ux, Uy), ...}
, useNone
forUx
orUy
when this component is not concerned - F_dict (dict) – Prescribed nodal force
{point_id: (Fx, Fy), ...}
- sig0 (ndarray, shape (n_lines, )) – Initial stress
- construct_K (bool) – Whether force reconstructing and performing LU factorization of the stiffness matrix
Returns: - u (ndarray, shape (n_ddl, )) – Displacement solution
- eps (ndarray, shape (n_lines, )) – Strain
- sig (ndarray, shape (n_lines, )) – Stress
- points (ndarray, shape (n_points, dim)) – Point coordinates with spatial dimension
-
class
ddtruss.
DataDrivenSolver
(truss)¶ Data-driven solver for truss structures
Parameters: truss – Object defining the truss structure -
load_material_data
(material_data)¶ Load one-dimensional material data
Parameters: material_data (ndarray, shape (n_data, 2)) – Experimentally measured (strain, stress)
pairs
-
solve
(A=1, U_dict={}, F_dict={}, n_iterations=100, E_num=None, n_neighbors=1, idx=None, save_history=False)¶ Solve the static equilibrium problem for the truss structure using a data-driven approach
Parameters: - A (float or ndarray, shape (n_lines, )) – Cross section area
- U_dict (dict) – Prescribed displacement
{point_id: (Ux, Uy), ...}
- F_dict (dict) – Prescribed nodal force
{point_id: (Fx, Fy), ...}
- n_iterations (int) – Maximimum iteration for the data-driven solver
- E_num (float) – Numerical value
- n_neighbors (int) – Number of nearest local states to look for in the material data
- idx (ndarray, shape (n_lines, )) – Initial local states
- save_history (bool) – Whether also save more iteration history
Returns: - u (ndarray, shape (n_ddl, )) – Displacement solution
- eps (ndarray, shape (n_lines, )) – Strain
- sig (ndarray, shape (n_lines, )) – Stress
- iter_history (ndarray) – Iteration history for objective function and if asked strain/stress
-