-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
101 lines (91 loc) · 4.21 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 2016-2018 Iowa State University Research Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pickle
import numpy as np
from autofiber.generator import AutoFiber as AF
# Define the material properties of the composite fiber material. Since all of the models used here are using mm as
# as distance units then our material properties must be in GPa in order to get strain energy in J/mm. See
# optimization.py line 99.
materialproperties = (
# Young's Modulus [E1, E2, E3]
[1.415e11/1.e9, 8.5e9/1.e9, 8.5e9/1.e9],
# Poisson's ratio [nu12, nu13, nu23]
[0.33, 0.33, 0.33],
# Shear Modulus [G12, G13, G23]
[5.02e9/1.e9, 5.02e9/1.e9, 2.35e9/1.e9])
# Flat plate - X3D - Anisotropic material properties
# Path to X3D CAD model
# test = AF('demos/FlatPlate.x3d',
# # Point close to the center of the model
# np.array([1.0, -1.0, 0.0]),
# # Vector pointing in fiber direction
# np.array([-np.cos(np.deg2rad(angle)), np.sin(np.deg2rad(angle)), 0]),
# # Vector pointing in the primary normal to the surface
# np.array([0, 0, 1]),
# # Material properties of the composite fiber material
# materialproperties=materialproperties,
# # Geodesic spacing interval
# fiberint=0.01)
# test.load_model()
# test.evaluate()
# Compute an orientation given a fiber angle
# texcoords2inplane = test.layup(0.0, plotting=True)
# Cylinder - X3D - Anisotropic material properties
# test = AF('demos/Cylinder.x3d',
# np.array([0.0, 0.0, 1.0]),
# np.array([np.sin(-1 * np.deg2rad(angle)), np.cos(np.deg2rad(angle)), 0.0]),
# np.array([0, 0, 1.0]),
# materialproperties=materialproperties,
# fiberint=0.05)
# test.load_model()
# test.evaluate()
# texcoords2inplane = test.layup(0.0, plotting=True)
# Saddle model - X3D - Anisotropic material properties
# test = AF('demos/SmallSaddle32.x3d',
# np.array([0.0, 1.0, 0.0]),
# np.array([-np.cos(np.deg2rad(angle)), 0, -np.sin(np.deg2rad(angle))]),
# np.array([0, 1, 0]),
# materialproperties=materialproperties,
# fiberint=0.01,
# Further angle to be applied to the given fiber direction
# This is typically used as a tolerance in the fiber angle but
# can be used to rotate the base parameterization such as in the case
# of the saddle part we can actually define a parameterization easily at 45.0 degrees.
# Recommended to be any number except exactly zero
# angle_error=45.0)
# test.load_model()
# test.evaluate()
# texcoords2inplane = test.layup(0.0, plotting=True)
# Curved Composite Mold / De-La-Mo - DMObject - Anisotropic material properties
# test = AF(pickle.load(open('demos/DMObject.pkl', 'rb')), # mm
# np.array([0.0, 0.0, 3.0]),
# np.array([np.cos(np.deg2rad(angle)), np.sin(np.deg2rad(angle)), 0.0]),
# np.array([0, 0, 1]),
# materialproperties=materialproperties,
# fiberint=0.25)
# Can define mesh coordinates at which the orientation can be computed
# meshcoords = np.load("demos/curved_abaqus_mesh_coords.npy")
# test.load_model()
# test.evaluate()
# texcoords2inplane = test.layup(0.0, orientation_locations=meshcoords, plotting=True)
# Armchair model - X3D - Anisotropic material properties
test = AF('demos/armchair.x3d', # mm
np.array([0.8, 1.0, 0.8]),
np.array([np.cos(np.deg2rad(0.0)), 0.0, np.sin(np.deg2rad(0.0))]),
np.array([0, 1.0, 0]),
materialproperties=materialproperties,
fiberint=0.1)
test.load_model()
test.evaluate()
texcoords2inplane = test.layup(-135.0, precision=1e-6, plotting=True)