Skip to content

Commit

Permalink
Making it easier to define orthotropic properties using MaterialPrope…
Browse files Browse the repository at this point in the history
…rties class (#252)

* Fixing kappa init bug in MaterialProperties

* Generalizing orthotropic check in MaterialProperties

* Fixing incorrect cte kwarg in multiple places for MaterialProperties

* More cte fixes
  • Loading branch information
timryanb authored Oct 2, 2023
1 parent c53aa9d commit 2ba120b
Show file tree
Hide file tree
Showing 38 changed files with 52 additions and 40 deletions.
2 changes: 1 addition & 1 deletion examples/fuselage/composite_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def elemCallBack(dvNum, compID, compDescript, elemDescripts, globalDVs, **kwargs
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
4 changes: 4 additions & 0 deletions src/constitutive/TACSMaterialProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ TACSMaterialProperties::TACSMaterialProperties(
alpha1 = _alpha1;
alpha2 = _alpha2;
alpha3 = _alpha3;

kappa1 = _kappa1;
kappa2 = _kappa2;
kappa3 = _kappa3;
}

// Get the material type
Expand Down
10 changes: 9 additions & 1 deletion tacs/constitutive.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ cdef class MaterialProperties:
cdef TacsScalar kappa2 = 230.0
cdef TacsScalar kappa3 = 230.0

ISOTROPIC_KEYS = ["rho", "E", "nu", "G", "ys", "alpha", "specific_heat", "kappa"]

# Check if any input provided in kwargs was orthotropic
if any(input_key not in ISOTROPIC_KEYS for input_key in kwargs):
is_orthotropic = True
else:
is_orthotropic = False

if 'rho' in kwargs:
rho = kwargs['rho']
if 'specific_heat' in kwargs:
Expand Down Expand Up @@ -313,7 +321,7 @@ cdef class MaterialProperties:
if 'kappa3' in kwargs:
kappa3 = kwargs['kappa3']

if 'E1' in kwargs:
if is_orthotropic:
self.ptr = new TACSMaterialProperties(rho, specific_heat, E1, E2, E3,
nu12, nu13, nu23, G12, G13, G23,
T1, C1, T2, C2, T3, C3, S12, S13, S23,
Expand Down
2 changes: 1 addition & 1 deletion tests/constitutive_tests/test_basic_beam_constitutive.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)
iso_ply = constitutive.OrthotropicPly(1e-3, iso_prop)
Expand Down Expand Up @@ -129,7 +129,7 @@ def setUp(self):
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)
ortho_ply = constitutive.OrthotropicPly(1e-3, ortho_prop)
Expand Down
4 changes: 2 additions & 2 deletions tests/constitutive_tests/test_composite_shell_constitutive.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)
iso_ply = constitutive.OrthotropicPly(ply_thickness, iso_prop)
Expand Down Expand Up @@ -82,7 +82,7 @@ def setUp(self):
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)
ortho_ply = constitutive.OrthotropicPly(ply_thickness, ortho_prop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)
t = 0.1
Expand Down
2 changes: 1 addition & 1 deletion tests/constitutive_tests/test_iso_shell_constitutive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)
t = 0.1
Expand Down
2 changes: 1 addition & 1 deletion tests/constitutive_tests/test_plane_stress_constitutive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)
iso_ply = constitutive.OrthotropicPly(thickness, iso_prop)
Expand Down Expand Up @@ -79,7 +79,7 @@ def setUp(self):
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)
ortho_ply = constitutive.OrthotropicPly(thickness, ortho_prop)
Expand Down
2 changes: 1 addition & 1 deletion tests/constitutive_tests/test_solid_constitutive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/shell_tests/test_beam_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/shell_tests/test_beam_traction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/shell_tests/test_shell_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/shell_tests/test_shell_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/shell_tests/test_shell_traction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_centrifugal_force_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_element_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_element_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_heat_conduction_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_heat_conduction_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_inertial_force_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_inertial_force_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_linear_elasticity_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_linear_elasticity_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_linear_thermoelasticity_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_linear_thermoelasticity_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_pressure_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_pressure_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_traction_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/element_tests/test_traction_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
E=E,
nu=nu,
ys=ys,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_shell_beam_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setup_assembler(self, comm, dtype):
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_shell_comp_smeared.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def setup_tacs_problems(self, comm):
Yt=Yt,
Yc=Yc,
S12=S12,
cte=cte,
alpha=cte,
kappa=kappa,
)
ortho_ply = constitutive.OrthotropicPly(ply_thickness, ortho_prop)
Expand Down

0 comments on commit 2ba120b

Please sign in to comment.