-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPPMatSolid.py
More file actions
62 lines (53 loc) · 2.14 KB
/
PPMatSolid.py
File metadata and controls
62 lines (53 loc) · 2.14 KB
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
# Modified from the original file, which can be found in https://github.com/USArmyResearchLab/ParaPower
from PPMAT import PPMat
class PPMatSolid(PPMat):
def __init__(self, **kwargs):
# Default Values
self.cte = float('nan')
self.E = float('nan')
self.nu = float('nan')
self.k = float('nan')
self.rho = float('nan')
self.cp = float('nan')
self.type = "Solid"
if "type" not in kwargs:
kwargs["type"] = self.type
super().__init__(**kwargs) # Call the parent constructor
prop_val_pairs = self.prop_val_pairs
self.prop_val_pairs = {}
while prop_val_pairs:
key, element, prop_val_pairs = self.pop(prop_val_pairs)
if not isinstance(key, str):
raise ValueError("Property Name must be a string!")
if key.lower().startswith("cte"):
self.cte = element
elif key.lower().startswith("e"):
self.E = element
elif key.lower().startswith("nu"):
self.nu = element
elif key.lower().startswith("k"):
self.k = element
elif key.lower().startswith("rho"):
self.rho = element
elif key.lower().startswith("cp"):
self.cp = element
else:
raise ValueError("Property not recognized!")
def ParamDesc(self, Param):
out_text = ''
lower_param = Param.lower()
if lower_param == 'cte':
out_text = 'CTE (1/K)'
elif lower_param == 'e':
out_text = "Young's Mod (Pa)"
elif lower_param == 'nu':
out_text = "Poisson's Ratio"
elif lower_param == 'k':
out_text = 'Conductivity (W/m-K)'
elif lower_param == 'rho':
out_text = 'Density (kg/m^3)'
elif lower_param == 'cp':
out_text = 'Specific Heat (J/kg-K)'
else:
out_text = super().ParamDesc(Param) # Call the superclass method if not found
return out_text