Skip to content

Commit

Permalink
verbose documentation
Browse files Browse the repository at this point in the history
verbose docs
  • Loading branch information
Sam-Bouten committed Sep 23, 2021
1 parent dce8a8e commit 9072351
Show file tree
Hide file tree
Showing 15 changed files with 546 additions and 308 deletions.
8 changes: 5 additions & 3 deletions scripts/91_nfd_hypar.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10, s_calc=1)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q,
vertex_loads=P, kmax=10, stress_flag=1)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
9 changes: 5 additions & 4 deletions scripts/92_nfd_hypar_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=1, s_tol=.05, xyz_tol=.01)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=1, stress_tol=.05, xyz_tol=.01)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
9 changes: 5 additions & 4 deletions scripts/93_nfd_hypar_quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=1, s_tol=.05, xyz_tol=.01)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=1, stress_tol=.05, xyz_tol=.01)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
11 changes: 6 additions & 5 deletions scripts/94_nfd_hypar_quads_tris.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
mesh.split_face(face, v[0], v[2])

bounds = mesh.edges_on_boundaries()[0]
mesh.edges_attribute('q_pre', 20, bounds)
mesh.edges_attribute('q_pre', 15, bounds)

dva = {'rx': .0, 'ry': .0, 'rz': .0,
'px': .0, 'py': .0, 'pz': .0,
Expand All @@ -47,22 +47,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=1, s_tol=.05, xyz_tol=.01)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=1, stress_tol=.05, xyz_tol=.01)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
9 changes: 5 additions & 4 deletions scripts/95_nfd_hypar_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=1, s_tol=.001, xyz_tol=.001)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=1, stress_tol=.01, xyz_tol=.01)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
11 changes: 6 additions & 5 deletions scripts/96_nfd_hypar_anisotropic_stress_A.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
mesh.quads_to_triangles()

bounds = mesh.edges_on_boundaries()[0]
mesh.edges_attribute('q_pre', 40, bounds)
mesh.edges_attribute('q_pre', 30, bounds)

dva = {'rx': .0, 'ry': .0, 'rz': .0,
'px': .0, 'py': .0, 'pz': .0,
Expand All @@ -44,22 +44,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=3, s_ref=(1, 1, 0))
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=3, stress_ref=(1, 1, 0))
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
11 changes: 6 additions & 5 deletions scripts/97_nfd_hypar_anisotropic_stress_B.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
mesh.quads_to_triangles()

bounds = mesh.edges_on_boundaries()[0]
mesh.edges_attribute('q_pre', 40, bounds)
mesh.edges_attribute('q_pre', 30, bounds)

dva = {'rx': .0, 'ry': .0, 'rz': .0,
'px': .0, 'py': .0, 'pz': .0,
Expand All @@ -44,22 +44,23 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.vertices_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
s_calc=3, s_ref=(1, 0.5, 0))
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, vertex_loads=P,
kmax=10, stress_flag=3, stress_ref=(1, 0.5, 0))
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
7 changes: 4 additions & 3 deletions scripts/98_nfd_hypar_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,22 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P = mesh.faces_attributes(['px', 'py', 'pz'])
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, global_face_loads=P, kmax=5, s_calc=1)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, global_face_loads=P, kmax=5, stress_flag=1)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
9 changes: 5 additions & 4 deletions scripts/99_nfd_inflated_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,24 @@
# get mesh data
# =================================================

fixed = [mesh.key_index()[v] for v in mesh.vertices_where({'is_anchor': True})]
P1 = mesh.faces_attributes(['px', 'py', 'pz'])
P2 = [-0.2 * p for load_vec in P1 for p in load_vec]
S = mesh.faces_attribute('s_pre')
Q = mesh.edges_attribute('q_pre')


# =================================================
# run solver
# solver
# =================================================

xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, local_face_loads=P1,
global_face_loads=P2, kmax=5, s_calc=1)
xyz, r, f, _, s = nfd_ur_numpy(mesh, fixed, S, force_density_goals=Q, local_face_loads=P1,
global_face_loads=P2, kmax=5, stress_flag=1)
mesh_update(mesh, xyz, r, s, f)


# =================================================
# visualisation
# viz
# =================================================

viewer = app.App()
Expand Down
5 changes: 4 additions & 1 deletion src/compas_fd/fd/result.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Any
from typing import List
from typing import Tuple
from typing import NamedTuple
from typing import Union
from nptyping import NDArray

import numpy as np
Expand All @@ -10,4 +12,5 @@ class Result(NamedTuple):
vertices: NDArray[(Any, 3), np.float64]
residuals: NDArray[(Any, 3), np.float64]
forces: List[float]
lenghts: List[float]
lengths: List[float]
stresses: Union[Tuple, None] = None
Loading

0 comments on commit 9072351

Please sign in to comment.