Skip to content

Commit

Permalink
Gaussian Process Buckling Constraints in Blade Stiffened Shell Consti…
Browse files Browse the repository at this point in the history
…tutive Subclass (#311)

* demonstrate exploded views

* prototype of the TACSGPBladestiffenedshellconstitutive class

* prototype closed-form buckling constraints

* outline of TACS assembler subroutine to compute panel dimensions

* prototype panel dimensions computation

* prototype computePanelDimensions routine

* update failure criterion with new buckling constraints

* update GP blade stiffened

* cleanup mass moment and MOI calls

* clang-format and add setPanelLength and width subroutines

* clang format

* remove computePanelDimensions

* add panel width constraint

* prototype of panel width constraint

* remove needsPanelDimensions

* update the failure sensitivities for GP constitutive

* update gaussian process folder

* update GP Model.h file

* demo gaussian process models

* prototype for GP buckling constraints and full GP failure criterion

* add tests of each nondimensional parameter and critical load

* begin making the unittest for TACS GP blade stiffened shell constitutive class

* clang reformat

* update makefile to compile TACSGPBlade stiffened

* successfully compiling versions of the GP Model and GP constitutive class

* add cython code for GP blade stiffened constitutive and the GP models

* first compiling cython objects for GP models and constitutive

* prototype for python level constitutive test on GP constitutive class

* change subclass structure for gp constitutive at the cython level

* fix GP model pointers in Cython constructor of GP const

* first fully running prototype of the test_gp_blade_shell_constitutive

* fix all nondimensional parameter tests

* working closed-form internal tests

* clang-format

* save current progress on fixing ML kernel derivatives

* fix the ML internal tests

* save progress on fixing axial global critical ML load

* working internal tests with ML buckling constraints in the loop!

* add TACS prefix to all C++ GaussianProcessModel classes

* add from_csv methods to build the GP models

* add stiffenerCripplingStiffness routine for stiffener crippling load

* working fail strain sens derivs in TACSGPBladeStiffenedShellConstitutive class

* fixed all but stiffener crippling failDV sens now

* all gp constitutive tests pass now!

* remove default print statements from gp blade tests

* fix a Newton iteration bug in the shear closed-form solution

* add closed-form demo example

* undo free GP pointers bug

* setkS

* change transverse shear parameter formula

* clang-format

* change zeta transformed parameter again

* fix jacobian of new zeta parameter

* fix bug in reading in the csv archived model data

* updated the closed form and axialGP examples

* change xi value in demo scripts

* update GP blade constitutive parameters

* fix the derivatives for the corrected shear closed-form solution

* update panel length and width constraints for F2F compatibility

* black reformat

* add TACSPanelGPs class to improve the runtime

* fix reset saved data check

* running ML optimization although one derivative doesn't work

* update nondim shear solution

* update the tacs constituve pxd file

* fix gamma for shear case and crippling load

* fix memory leaks!

* fix all bug failDV ML test so far

* fix derivatives after removing memory leaks

* fix unittests and add some debug DV printouts

* fix kernels to match kernel option 9 in ml_buckling

* improved analytic shear surrogate model for intermediate aspect ratios

* update panel length

* update unittests

* change name from test to check in examples folder

* remove print statements

* turn off setKS weight into ML model

* improvements to ML buckling model

* update pyproject.toml also

* add component input to average stresses in TACS assembler

* update shear closed-form with lowAR pred

* add TACS blade stiffened shell optimization example for gp-const

* fix closed-form shear loads soft_max to soft_min

* update the way panel D matrix is computed with centroid

* working derivatives tests and buckling benchmark!

* add ability to see failure values

* remove printout

* update the GP local buckling constraints

* fix new memory leak

* update gp stiffened plate examples

* working derivative tests after merge with Ali's blade stiffened updates

* add way to change stiffener crippling prediction mode

* working functors

* fix bug in constructing GPbladeconstitutive

* fix introduced shear loads bug

* fix complex step test and black reformat

* clang google format

* clang format

* clang format headers

* remove extra print statement

* switch from functors to virtual and overridden methods

* documentation for the TACS GP constitutive class in constitutive.pyx

* fix the documentation for local mode buckling predictions

* address new and delete[] issues, docstrings, cleanup examples, etc.

* remove redundant methods in constitutive.pyx

* add cptrs in constitutive.pyx to make integration tests pass

* update docs and docstrings

* fix panel width docs
  • Loading branch information
sean-engelstad authored Oct 22, 2024
1 parent 61548b1 commit 6e97dda
Show file tree
Hide file tree
Showing 33 changed files with 8,184 additions and 172 deletions.
1 change: 1 addition & 0 deletions docs/source/pytacs/constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Constraint classes
adjacency
dvcon
panel_length
panel_width
volume
9 changes: 9 additions & 0 deletions docs/source/pytacs/panel_width.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PanelWidthConstraint
---------------------
.. automodule:: tacs.constraints.panel_width

API Reference
^^^^^^^^^^^^^
.. autoclass:: tacs.constraints.PanelWidthConstraint
:members:
:inherited-members:
70 changes: 70 additions & 0 deletions examples/gp_panel_buckling/1_closed_form_axial_modes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""
Check axial closed-form modes in GPBladeStiffenedShellConstitutive class are reasonable
@Author Sean Engelstad
@Date 05/16/2024
"""

import numpy as np
import matplotlib.pyplot as plt
import niceplots
from tacs import TACS, constitutive

DEG2RAD = np.pi / 180.0

dtype = TACS.dtype

# Create the orthotropic layup
ortho_prop = constitutive.MaterialProperties(
rho=1550,
specific_heat=921.096,
E1=54e3,
E2=18e3,
nu12=0.25,
G12=9e3,
G13=9e3,
G23=9e3,
Xt=2410.0,
Xc=1040.0,
Yt=73.0,
Yc=173.0,
S12=71.0,
alpha=24.0e-6,
kappa=230.0,
)
ortho_ply = constitutive.OrthotropicPly(1e-3, ortho_prop)

# don't put in any GP models (so using closed-form solutions rn)
con = constitutive.GPBladeStiffenedShellConstitutive(
panelPly=ortho_ply,
stiffenerPly=ortho_ply,
panelLength=2.0,
stiffenerPitch=0.2,
panelThick=1.5e-2,
panelPlyAngles=np.array([0.0, 45.0, 90.0], dtype=dtype) * DEG2RAD,
panelPlyFracs=np.array([0.5, 0.3, 0.2], dtype=dtype),
stiffenerHeight=0.075,
stiffenerThick=1e-2,
stiffenerPlyAngles=np.array([0.0, 60.0], dtype=dtype) * DEG2RAD,
stiffenerPlyFracs=np.array([0.6, 0.4], dtype=dtype),
panelWidth=1.0,
flangeFraction=0.8,
)

xi = 1.0 # 0.4

# get the axial loads in nondimensional space w.r.t. rho_0
n = 500
plt.style.use(niceplots.get_style())
rho0_vec = np.linspace(0.5, 10.0, n)
N11cr_vec = np.zeros((n,), dtype=dtype)
for gamma in [0.0, 0.1, 0.5, 1.0]:
for i, rho0 in enumerate(rho0_vec):
N11cr_vec[i] = con.nondimCriticalGlobalAxialLoad(rho0, xi, gamma)
plt.plot(rho0_vec, N11cr_vec, label=f"gamma={gamma:.2f}")

# plot it
plt.margins(x=0.05, y=0.05)
plt.xlabel(r"$\rho_0$")
plt.ylabel(r"$N_{11,cr}^*$")
plt.legend()
plt.savefig("1-verify.png", dpi=400)
71 changes: 71 additions & 0 deletions examples/gp_panel_buckling/1_closed_form_shear_modes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""
Check axial closed-form modes in GPBladeStiffenedShellConstitutive class are reasonable
@Author Sean Engelstad
@Date 05/16/2024
"""

import numpy as np
import matplotlib.pyplot as plt
import niceplots
from tacs import TACS, constitutive

DEG2RAD = np.pi / 180.0

dtype = TACS.dtype

# Create the orthotropic layup
ortho_prop = constitutive.MaterialProperties(
rho=1550,
specific_heat=921.096,
E1=54e3,
E2=18e3,
nu12=0.25,
G12=9e3,
G13=9e3,
G23=9e3,
Xt=2410.0,
Xc=1040.0,
Yt=73.0,
Yc=173.0,
S12=71.0,
alpha=24.0e-6,
kappa=230.0,
)
ortho_ply = constitutive.OrthotropicPly(1e-3, ortho_prop)

# don't put in any GP models (so using closed-form solutions rn)
con = constitutive.GPBladeStiffenedShellConstitutive(
panelPly=ortho_ply,
stiffenerPly=ortho_ply,
panelLength=2.0,
stiffenerPitch=0.2,
panelThick=1.5e-2,
panelPlyAngles=np.array([0.0, 45.0, 90.0], dtype=dtype) * DEG2RAD,
panelPlyFracs=np.array([0.5, 0.3, 0.2], dtype=dtype),
stiffenerHeight=0.075,
stiffenerThick=1e-2,
stiffenerPlyAngles=np.array([0.0, 60.0], dtype=dtype) * DEG2RAD,
stiffenerPlyFracs=np.array([0.6, 0.4], dtype=dtype),
panelWidth=1.0,
flangeFraction=0.8,
)
# Set the KS weight really low so that all failure modes make a
# significant contribution to the failure function derivatives
con.setKSWeight(20.0)

# get the axial loads in nondimensional space w.r.t. rho_0
n = 500
plt.style.use(niceplots.get_style())
rho0_vec = np.linspace(0.5, 10.0, n)
N12cr_vec = np.zeros((n,), dtype=dtype)
for gamma in [0.0, 0.1, 0.5, 1.0]:
for i, rho0 in enumerate(rho0_vec):
N12cr_vec[i] = con.nondimCriticalGlobalShearLoad(rho0, 0.4, gamma)
plt.plot(rho0_vec, N12cr_vec, label=f"gamma={gamma:.2f}")

# plot it
plt.margins(x=0.05, y=0.05)
plt.xlabel(r"$\rho_0$")
plt.ylabel(r"$N_{12,cr}^*$")
plt.legend()
plt.savefig("1-verify-shear.png", dpi=400)
85 changes: 85 additions & 0 deletions examples/gp_panel_buckling/2_axialGP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""
Check axial closed-form modes in GPBladeStiffenedShellConstitutive class are reasonable
@Author Sean Engelstad
@Date 05/16/2024
Use the repo https://github.com/smdogroup/ml_buckling
"""

import numpy as np
import matplotlib.pyplot as plt
import niceplots
from tacs import TACS, constitutive
import ml_buckling as mlb

DEG2RAD = np.pi / 180.0

dtype = TACS.dtype

# Create the orthotropic layup
ortho_prop = constitutive.MaterialProperties(
rho=1550,
specific_heat=921.096,
E1=54e3,
E2=18e3,
nu12=0.25,
G12=9e3,
G13=9e3,
G23=9e3,
Xt=2410.0,
Xc=1040.0,
Yt=73.0,
Yc=173.0,
S12=71.0,
alpha=24.0e-6,
kappa=230.0,
)
ortho_ply = constitutive.OrthotropicPly(1e-3, ortho_prop)

# build the axial GP object (which is the main ML object we are testing for this example)
# however it is used inside of the constitutive object so we need to build that too
axialGP = constitutive.BucklingGP.from_csv(
csv_file=mlb.axialGP_csv, theta_csv=mlb.axial_theta_csv
)
panelGP = constitutive.PanelGPs(axialGP=axialGP)

# don't put in any GP models (so using closed-form solutions rn)
con = constitutive.GPBladeStiffenedShellConstitutive(
panelPly=ortho_ply,
stiffenerPly=ortho_ply,
panelLength=2.0,
stiffenerPitch=0.2,
panelThick=1.5e-2,
panelPlyAngles=np.array([0.0, 45.0, 90.0], dtype=dtype) * DEG2RAD,
panelPlyFracs=np.array([0.5, 0.3, 0.2], dtype=dtype),
stiffenerHeight=0.075,
stiffenerThick=1e-2,
stiffenerPlyAngles=np.array([0.0, 60.0], dtype=dtype) * DEG2RAD,
stiffenerPlyFracs=np.array([0.6, 0.4], dtype=dtype),
panelWidth=1.0,
flangeFraction=0.8,
panelGPs=panelGP,
)
# Set the KS weight really low so that all failure modes make a
# significant contribution to the failure function derivatives
# be careful changing the KS weight => will retrain alpha..
# con.setKSWeight(20.0)

xi = 1.0 # 0.4

# get the axial loads in nondimensional space w.r.t. rho_0
n = 500
plt.style.use(niceplots.get_style())
rho0_vec = np.linspace(0.5, 10.0, n)
N11cr_vec = np.zeros((n,), dtype=TACS.dtype)
for gamma in [0.0, 0.1, 0.5, 1.0]:
for i, rho0 in enumerate(rho0_vec):
N11cr_vec[i] = con.nondimCriticalGlobalAxialLoad(rho0, xi, gamma, 0.0)
plt.plot(rho0_vec, N11cr_vec, label=f"gamma={gamma:.2f}")

# plot it
plt.margins(x=0.05, y=0.05)
plt.xlabel(r"$\rho_0$")
plt.ylabel(r"$N_{11,cr}^*$")
plt.legend()
plt.savefig("2-verify-ML.png", dpi=400)
82 changes: 82 additions & 0 deletions examples/gp_panel_buckling/2_shearGP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""
Check axial closed-form modes in GPBladeStiffenedShellConstitutive class are reasonable
@Author Sean Engelstad
@Date 05/16/2024
Use the repo https://github.com/smdogroup/ml_buckling
"""

import numpy as np
import matplotlib.pyplot as plt
import niceplots
from tacs import TACS, constitutive
import ml_buckling as mlb

DEG2RAD = np.pi / 180.0

dtype = TACS.dtype

# Create the orthotropic layup
ortho_prop = constitutive.MaterialProperties(
rho=1550,
specific_heat=921.096,
E1=54e3,
E2=18e3,
nu12=0.25,
G12=9e3,
G13=9e3,
G23=9e3,
Xt=2410.0,
Xc=1040.0,
Yt=73.0,
Yc=173.0,
S12=71.0,
alpha=24.0e-6,
kappa=230.0,
)
ortho_ply = constitutive.OrthotropicPly(1e-3, ortho_prop)

# build the axial GP object (which is the main ML object we are testing for this example)
# however it is used inside of the constitutive object so we need to build that too
shearGP = constitutive.BucklingGP.from_csv(
csv_file=mlb.shearGP_csv, theta_csv=mlb.shear_theta_csv
)
panelGP = constitutive.PanelGPs(shearGP=shearGP)

# don't put in any GP models (so using closed-form solutions rn)
con = constitutive.GPBladeStiffenedShellConstitutive(
panelPly=ortho_ply,
stiffenerPly=ortho_ply,
panelLength=2.0,
stiffenerPitch=0.2,
panelThick=1.5e-2,
panelPlyAngles=np.array([0.0, 45.0, 90.0], dtype=dtype) * DEG2RAD,
panelPlyFracs=np.array([0.5, 0.3, 0.2], dtype=dtype),
stiffenerHeight=0.075,
stiffenerThick=1e-2,
stiffenerPlyAngles=np.array([0.0, 60.0], dtype=dtype) * DEG2RAD,
stiffenerPlyFracs=np.array([0.6, 0.4], dtype=dtype),
panelWidth=1.0,
flangeFraction=0.8,
panelGPs=panelGP,
)
# Set the KS weight really low so that all failure modes make a
# significant contribution to the failure function derivatives
con.setKSWeight(20.0)

# get the axial loads in nondimensional space w.r.t. rho_0
n = 500
plt.style.use(niceplots.get_style())
rho0_vec = np.linspace(0.5, 10.0, n)
N12cr_vec = np.zeros((n,), dtype=TACS.dtype)
for gamma in [0.0, 0.1, 0.5, 1.0]:
for i, rho0 in enumerate(rho0_vec):
N12cr_vec[i] = con.nondimCriticalGlobalShearLoad(rho0, 0.4, gamma, 0.0)
plt.plot(rho0_vec, N12cr_vec, label=f"gamma={gamma:.2f}")

# plot it
plt.margins(x=0.05, y=0.05)
plt.xlabel(r"$\rho_0$")
plt.ylabel(r"$N_{12,cr}^*$")
plt.legend()
plt.savefig("2-verify-ML-shear.png", dpi=400)
Loading

0 comments on commit 6e97dda

Please sign in to comment.