-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding buckling eigenvalue solver (#213)
* Adding geometric stiffness to shell elements * Adding TACSBuckling API to cython wrapper * Adding BucklingProblem class * Adding buckling integration test * clang format fixes * loosening up shell test tol * Adding buckling solver to mphys wrapper * Minor mphys refactor * Clang format fixes * Reducing mesh size for mphys buckling test * Increasing testflo CI timelimit * Updating sigma value in eigenvalue test * Adding rtol setting to ModalProblem setup * Adding buckling example and benchmark * Reducing N_PROCS to 1 for mphys buckling test
- Loading branch information
Showing
22 changed files
with
4,863 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
BucklingProblem | ||
------------ | ||
.. automodule:: tacs.problems.buckling | ||
|
||
Options | ||
^^^^^^^ | ||
Options can be set for :class:`~tacs.problems.BucklingProblem` at time of creation for the class in the | ||
:meth:`pyTACS.createBucklingProblem <tacs.pytacs.pyTACS.createBucklingProblem>` method or using the | ||
:meth:`BucklingProblem.setOption <tacs.problems.BucklingProblem.setOption>` method. Current option values for a class | ||
instance can be printed out using the :meth:`BucklingProblem.printOption <tacs.problems.BucklingProblem.printOptions>` method. | ||
The following options, their default values and descriptions are listed below: | ||
|
||
.. program-output:: python -c "from tacs.problems import BucklingProblem; BucklingProblem.printDefaultOptions()" | ||
|
||
API Reference | ||
^^^^^^^^^^^^^ | ||
.. autoclass:: tacs.problems.BucklingProblem | ||
:members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ Problem classes | |
|
||
static | ||
transient | ||
modal | ||
modal | ||
buckling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
This script is used to regression test the example against historical values. | ||
""" | ||
|
||
import numpy as np | ||
import unittest | ||
import sys | ||
import os | ||
|
||
# Set the path to the example script we're testing | ||
example_path = os.path.join(os.path.dirname(__file__), "..") | ||
sys.path.append(example_path) | ||
|
||
# Reference values for eval functions | ||
FUNC_REF = { | ||
"buckle_eigsb.0": 20.082400947865022, | ||
"buckle_eigsb.1": 43.01440496545738, | ||
"buckle_eigsb.2": 80.31233170890538, | ||
"buckle_eigsb.3": 84.69751385025641, | ||
"buckle_eigsb.4": 86.82024838978569, | ||
} | ||
|
||
|
||
class ExampleBenchmark(unittest.TestCase): | ||
N_PROCS = 8 # this is how many MPI processes to use for this TestCase. | ||
|
||
def setUp(self): | ||
# Import the example to automatically run the script | ||
import plate_buckle | ||
|
||
self.example = plate_buckle | ||
|
||
def benchmark_funcs(self): | ||
""" | ||
Test the example eval functions against reference values | ||
""" | ||
func_dict = self.example.funcs | ||
|
||
# Test functions values against historical values | ||
for func_name in func_dict: | ||
with self.subTest(function=func_name): | ||
np.testing.assert_allclose( | ||
func_dict[func_name], FUNC_REF[func_name], rtol=1e-6, atol=1e-6 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
This problem performs a buckling analysis on a 4m x 3m flat plate. | ||
The perimeter of the plate is pinned and loaded in compression (20kN/m) on its horizontal edges. | ||
We use TACS buckling eigenvalue solver through the pyTACS BucklingProblem interface. | ||
""" | ||
# ============================================================================== | ||
# Standard Python modules | ||
# ============================================================================== | ||
from __future__ import print_function | ||
import os | ||
|
||
# ============================================================================== | ||
# External Python modules | ||
# ============================================================================== | ||
from pprint import pprint | ||
|
||
import numpy as np | ||
from mpi4py import MPI | ||
|
||
# ============================================================================== | ||
# Extension modules | ||
# ============================================================================== | ||
from tacs import pyTACS | ||
|
||
comm = MPI.COMM_WORLD | ||
|
||
# Instantiate FEAAssembler | ||
bdfFile = os.path.join(os.path.dirname(__file__), "ss_plate_buckle.bdf") | ||
FEAAssembler = pyTACS(bdfFile, comm=comm) | ||
# Set up constitutive objects and elements | ||
FEAAssembler.initialize() | ||
|
||
# Setup static problem | ||
bucklingProb = FEAAssembler.createBucklingProblem(name="buckle", sigma=10.0, numEigs=5) | ||
bucklingProb.setOption("printLevel", 2) | ||
# Add Loads | ||
bucklingProb.addLoadFromBDF(loadID=1) | ||
|
||
# solve and evaluate functions/sensitivities | ||
funcs = {} | ||
funcsSens = {} | ||
bucklingProb.solve() | ||
bucklingProb.evalFunctions(funcs) | ||
bucklingProb.evalFunctionsSens(funcsSens) | ||
bucklingProb.writeSolution(outputDir=os.path.dirname(__file__)) | ||
|
||
|
||
if comm.rank == 0: | ||
pprint(funcs) | ||
pprint(funcsSens) |
Oops, something went wrong.