Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bladeStiffenedShell constitutive model #212

Merged
merged 71 commits into from
Jun 30, 2023
Merged

Conversation

A-CGray
Copy link
Contributor

@A-CGray A-CGray commented May 19, 2023

This PR adds a new TACSBladeStiffenedShellConstitutive class, a new implementation of the old bladeFSDT class. It also adds a panel length constraint class to the pyTACS interface.

Constitutive model

Compared to the old bladeFSDT class, the new model contains a few improvements:

  1. The panel and stiffener laminates can now be made up of an arbitrary number of ply angles as opposed to being hardcoded to [0, -45, 45, 90] deg laminates. This means you can model more complex laminates and makes it simpler to model a shell made from an isotropic material as you no longer need to supply 4 copies of the same isotropic ply when creating the constitutive object.
  2. The buckling failure envelope is modified in a similar manner to Modify Tsai-Wu to work with safety factors #203 so that it can be used to ensure a specified buckling margin
  3. I fixed a bug (I think) in the critical buckling loads calculation where the $D_{12}$ entry of the bending stiffness was being used instead of $D_{22}$ to compute the $D_2$ value in Stroud and Agranoff's equations.
  4. Almost all of the calculations in the model have been rewritten in a way that computes contributions from the panel and stiffener as if they are distinct shell and beam constitutive models. My hope is that in the future, with a little more work, we could modify this model to create a stiffened shell model using any combination of existing TACS shell and beam constitutive models.

For example, this is how the stiffness matrix for the stiffened shell is computed:

// Compute the stiffness matrix
void TACSBladeStiffenedShellConstitutive::computeStiffness(TacsScalar C[]) {
  TacsScalar* A = &C[0];
  TacsScalar* B = &C[6];
  TacsScalar* D = &C[12];
  TacsScalar* As = &C[18];
  TacsScalar* drill = &C[21];

  // --- Zero out the C matrix ---
  memset(C, 0, this->NUM_TANGENT_STIFFNESS_ENTRIES * sizeof(TacsScalar));

  // Add the panel's stiffness contributions
  this->computePanelStiffness(C);

  // Compute the stiffener's beam stiffness matrix ,then transform it to a shell
  // stiffness matrix and add it
  TacsScalar Cstiff[TACSBeamConstitutive::NUM_TANGENT_STIFFNESS_ENTRIES];
  this->computeStiffenerStiffness(Cstiff);
  this->addStiffenerStiffness(Cstiff, C);
}

This code does not make any assumptions about the form of the panel or stiffener stiffness matrices and could easily be modified so that computePanelStiffness is actually a call to another shell constitutive model, and computeStiffenerStiffness is a call to a beam constitutive model.

Panel length constraints

I also implemented a panel length constraint class that is necessary to ensure the panel length values used in the buckling failure calculations are consistent with the true geometry of each TACS component. I used numba to speed up the panel length computation and its derivatives which means we would need to add Numba as a dependency of TACS. As far as I can tell this shouldn't be too much of a stability issue, numba has a pretty wide user-base, and is officially supported by organisations like Anaconda, Intel, and NVIDIA.

ToDo before merging:

@A-CGray
Copy link
Contributor Author

A-CGray commented Jun 1, 2023

@timryanb on further inspection, there was no issue with the Tsai-Wu sensitivities but there was an issue with the Von Mises sensitivities (not related to any changes in this PR) that I fixed. There were some issues with the finite difference tests for the blade stiffened model where the relative tolerance cannot be met because the absolute values of the derivatives are very small. To get around this I implemented a new type of pass/fail criteria for the unit tests based on numpy's assert_allclose. It basically acts like a relative tolerance when the values being compared are large but more like an absolute tolerance when the compared values are very small which fixes the issue I was facing.

This does change the criteria used for all the constitutive model unit tests, which I realise is a big change, and not related to the original purpose of this PR, so happy to make changes and possibly move this to another PR.

@A-CGray
Copy link
Contributor Author

A-CGray commented Jun 1, 2023

I stand corrected, there were a couple of uninitialized values causing problems only in the real tests when compiled in debug mode. I've fixed those and with the new assert_allclose check I was able to get all of the constitutive model tests passing with tighter tolerances

@timryanb
Copy link
Collaborator

timryanb commented Jun 1, 2023

Good find @A-CGray

The PR seems to drifting in scope a bit. Can we break the general test improvement/fixes into a separate dedicated PR?

A-CGray added 7 commits June 1, 2023 18:07
commit 6692030
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 17:25:13 2023 -0400

    Update beam constitutive model test tolerances

commit 05b6065
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 17:14:50 2023 -0400

    Turn off printing for composite shell test

commit 782eca6
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 16:49:44 2023 -0400

    Make `TacsAssertAllClose` more readable

commit a558e6e
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 16:49:25 2023 -0400

    Tighten tolerances even more

commit a769c19
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 16:49:07 2023 -0400

    Fix incorrect ordering of tolerances in composite shell test

commit eedd376
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 15:55:49 2023 -0400

    `black .`

commit 95c48b6
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 15:53:42 2023 -0400

    Tighten tolerances more

commit c8db3e5
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 15:19:02 2023 -0400

    Remove comments about not using `atol`

commit 5ec5c50
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 14:30:37 2023 -0400

    Tighten tolerances for constitutive tests

commit a83d610
Author: Alasdair Gray <alachris@umich.edu>
Date:   Wed May 31 21:40:17 2023 -0400

    Switch to `TacsAssertAllClose` for all constitutive tests

commit eaf712c
Author: Alasdair Gray <alachris@umich.edu>
Date:   Wed May 31 21:34:18 2023 -0400

    Add abs error printout to `TacsPrintErrorComponents`

commit 90b1a72
Author: Alasdair Gray <alachris@umich.edu>
Date:   Wed May 31 21:34:01 2023 -0400

    Fix `TacsAssertAllClose`

commit e6f3650
Author: Alasdair Gray <alachris@umich.edu>
Date:   Wed May 31 21:33:36 2023 -0400

    Switch to `TacsAssertAllClose` for failure criteria sens tests

commit 44b10ae
Author: Alasdair Gray <alachris@umich.edu>
Date:   Wed May 31 20:00:05 2023 -0400

    Add implementation of `assert_allclose`

commit 7da4b86
Merge: cc3d9f3 12ef9e0
Author: Alasdair Gray <alachris@umich.edu>
Date:   Thu Jun 1 15:04:59 2023 -0400

    Merge branch 'master' of https://github.com/smdogroup/tacs

commit 12ef9e0
Author: Tim Brooks <41971846+timryanb@users.noreply.github.com>
Date:   Tue May 30 13:57:48 2023 -0400

    Fixing issue with mpi4py build requirement on Python 3.11 (#215)
@A-CGray
Copy link
Contributor Author

A-CGray commented Jun 28, 2023

@timryanb I think once #216 is merged, the tests here should pass and this PR will be ready to go

@timryanb
Copy link
Collaborator

@A-CGray I had to rename the benchmark file to get testflo -b to work since we already had a file called benchmark_analysis.py and testflo didn't like that.

@A-CGray A-CGray requested a review from timryanb June 30, 2023 13:57
@gjkennedy gjkennedy merged commit da2b837 into master Jun 30, 2023
@gjkennedy gjkennedy deleted the bladeStiffenedShell branch June 30, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants