-
Notifications
You must be signed in to change notification settings - Fork 0
/
_solution_function_class.py
152 lines (118 loc) · 2.89 KB
/
_solution_function_class.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# -*- coding: utf-8 -*-
"""
@author: Olav M.S. Gran
"""
from .default_constants import default_tol
from .helpers import FunctionValues2D
class SolutionFunctionValues2D(FunctionValues2D):
def __init__(self):
"""
Setup
Returns
-------
None.
"""
super().__init__()
self._e_young = None
self._nu_poisson = None
self._nodal_stress = None
self._von_mises = None
def set_e_young_and_nu_poisson(self, e_young, nu_poisson):
"""
set which young's module and poisson ratio that was uses
Parameters
----------
e_young : float
young's module.
nu_poisson : float
poisson ratio.
Returns
-------
None.
"""
self._e_young = e_young
self._nu_poisson = nu_poisson
def check_e_young_and_nu_poisson(self, e_young, nu_poisson):
"""
Check if input young's module and poisson ratio is what was used
Parameters
----------
e_young : float
young's module.
nu_poisson : float
poisson ratio.
Returns
-------
bool
True if input young's module and poisson ratio is what was used.
"""
if self._values is None:
return False
elif abs(self._e_young - e_young) <= default_tol and abs(self._nu_poisson - nu_poisson) <= default_tol:
return True
else:
return False
def set_nodal_stress(self, nodal_stress):
"""
set the nodal stess property of the class
Parameters
----------
nodal_stress : np.array
nodal stress.
Returns
-------
None.
"""
self._nodal_stress = nodal_stress
def set_von_mises(self, von_mises):
"""
set the von mises yield property of the class
Parameters
----------
von_mises : np.array
von mises yield.
Returns
-------
None.
"""
self._von_mises = von_mises
@property
def e_young(self):
"""
The Young's module E
Returns
-------
float
the Young's module E.
"""
return self._e_young
@property
def nu_poisson(self):
"""
The Poisson ratio nu
Returns
-------
float
the Poisson ratio nu.
"""
return self._nu_poisson
@property
def nodal_stress(self):
"""
The nodal stress
Returns
-------
np.array
nodal stress.
"""
return self._nodal_stress
@property
def von_mises(self):
"""
Von Mises stress
Returns
-------
np.array
von Mises stress.
"""
return self._von_mises