structsolve 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- structsolve-0.3.0/LICENSE +12 -0
- structsolve-0.3.0/PKG-INFO +65 -0
- structsolve-0.3.0/README.md +29 -0
- structsolve-0.3.0/pyproject.toml +54 -0
- {structsolve-0.2.2 → structsolve-0.3.0}/setup.cfg +4 -4
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/__init__.py +23 -23
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/analysis.py +170 -170
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/arc_length_crisfield.py +166 -166
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/arc_length_riks.py +138 -138
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/freq.py +136 -123
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/linear_buckling.py +106 -92
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/logger.py +16 -16
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/newton_raphson.py +169 -165
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/sparseutils.py +193 -193
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve/static.py +71 -71
- structsolve-0.3.0/structsolve.egg-info/PKG-INFO +65 -0
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve.egg-info/SOURCES.txt +8 -3
- structsolve-0.3.0/structsolve.egg-info/requires.txt +10 -0
- structsolve-0.3.0/tests/test_analysis.py +73 -0
- structsolve-0.3.0/tests/test_freq.py +58 -0
- structsolve-0.3.0/tests/test_linear_buckling.py +155 -0
- structsolve-0.3.0/tests/test_sparseutils.py +89 -0
- structsolve-0.3.0/tests/test_static.py +63 -0
- structsolve-0.3.0/tests/test_static_deflection.py +95 -0
- structsolve-0.2.2/LICENSE +0 -23
- structsolve-0.2.2/PKG-INFO +0 -51
- structsolve-0.2.2/README.md +0 -29
- structsolve-0.2.2/setup.py +0 -114
- structsolve-0.2.2/structsolve/version.py +0 -1
- structsolve-0.2.2/structsolve.egg-info/PKG-INFO +0 -51
- structsolve-0.2.2/structsolve.egg-info/requires.txt +0 -4
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve.egg-info/dependency_links.txt +0 -0
- {structsolve-0.2.2 → structsolve-0.3.0}/structsolve.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2012-2026, Saullo G. P. Castro (S.G.P.Castro@tudelft.nl)
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: structsolve
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Structural analysis solvers
|
|
5
|
+
Author-email: "Saullo G. P. Castro" <castrosaullo@gmail.com>
|
|
6
|
+
License: BSD-2-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/compmech/structsolve
|
|
8
|
+
Project-URL: Repository, https://github.com/compmech/structsolve
|
|
9
|
+
Keywords: structural analysis,stress,vibration,linear buckling,newton raphson,arc length
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
22
|
+
Classifier: Operating System :: Unix
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: scipy
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest; extra == "test"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
31
|
+
Requires-Dist: flake8; extra == "test"
|
|
32
|
+
Requires-Dist: coverage; extra == "test"
|
|
33
|
+
Requires-Dist: composites; extra == "test"
|
|
34
|
+
Requires-Dist: buckling>=2026b4; extra == "test"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
Github Actions status:
|
|
38
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/pytest.yml)
|
|
39
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/pythonpublish.yml)
|
|
40
|
+
|
|
41
|
+
Coverage status:
|
|
42
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/coverage.yml)
|
|
43
|
+
[](https://codecov.io/gh/saullocastro/structsolve)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Structural analysis solvers tailored for semi-analytical models
|
|
47
|
+
===============================================================
|
|
48
|
+
|
|
49
|
+
- Linear statics: [K]{u} = {f}
|
|
50
|
+
- Eigensolver for Linear buckling: ([K] + lambda[KG]){u} = 0
|
|
51
|
+
- Eigensolver for dynamics: ([K] + lambda^2[M]){u} = 0
|
|
52
|
+
- Nonlinear statics using Newton-Raphson
|
|
53
|
+
- Nonlinear statics using the Arc-Length method
|
|
54
|
+
|
|
55
|
+
Currently these solvers are pretty much compatible with my other repositories
|
|
56
|
+
[panels](https://github.com/saullocastro/panels),
|
|
57
|
+
[buckling](https://github.com/saullocastro/buckling).
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
License
|
|
61
|
+
-------
|
|
62
|
+
Distrubuted in the 3-Clause BSD license (https://raw.github.com/saullocastro/structsolve/master/LICENSE).
|
|
63
|
+
|
|
64
|
+
Contact: S.G.P.Castro@tudelft.nl
|
|
65
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Github Actions status:
|
|
2
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/pytest.yml)
|
|
3
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/pythonpublish.yml)
|
|
4
|
+
|
|
5
|
+
Coverage status:
|
|
6
|
+
[](https://github.com/saullocastro/structsolve/actions/workflows/coverage.yml)
|
|
7
|
+
[](https://codecov.io/gh/saullocastro/structsolve)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Structural analysis solvers tailored for semi-analytical models
|
|
11
|
+
===============================================================
|
|
12
|
+
|
|
13
|
+
- Linear statics: [K]{u} = {f}
|
|
14
|
+
- Eigensolver for Linear buckling: ([K] + lambda[KG]){u} = 0
|
|
15
|
+
- Eigensolver for dynamics: ([K] + lambda^2[M]){u} = 0
|
|
16
|
+
- Nonlinear statics using Newton-Raphson
|
|
17
|
+
- Nonlinear statics using the Arc-Length method
|
|
18
|
+
|
|
19
|
+
Currently these solvers are pretty much compatible with my other repositories
|
|
20
|
+
[panels](https://github.com/saullocastro/panels),
|
|
21
|
+
[buckling](https://github.com/saullocastro/buckling).
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
License
|
|
25
|
+
-------
|
|
26
|
+
Distrubuted in the 3-Clause BSD license (https://raw.github.com/saullocastro/structsolve/master/LICENSE).
|
|
27
|
+
|
|
28
|
+
Contact: S.G.P.Castro@tudelft.nl
|
|
29
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "structsolve"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Structural analysis solvers"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "BSD-2-Clause"}
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Saullo G. P. Castro", email = "castrosaullo@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"structural analysis", "stress", "vibration", "linear buckling",
|
|
17
|
+
"newton raphson", "arc length",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Intended Audience :: Education",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
25
|
+
"License :: OSI Approved :: BSD License",
|
|
26
|
+
"Programming Language :: Python :: 3.9",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Operating System :: Microsoft :: Windows",
|
|
32
|
+
"Operating System :: Unix",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"numpy",
|
|
36
|
+
"scipy",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
test = [
|
|
41
|
+
"pytest",
|
|
42
|
+
"pytest-cov",
|
|
43
|
+
"flake8",
|
|
44
|
+
"coverage",
|
|
45
|
+
"composites",
|
|
46
|
+
"buckling>=2026b4",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/compmech/structsolve"
|
|
51
|
+
Repository = "https://github.com/compmech/structsolve"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
include = ["structsolve*"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
r"""
|
|
2
|
-
===============================================
|
|
3
|
-
Structural Analysis Solver (:mod:`structsolve`)
|
|
4
|
-
===============================================
|
|
5
|
-
|
|
6
|
-
.. currentmodule:: structsolve
|
|
7
|
-
|
|
8
|
-
.. autoclass:: Analysis
|
|
9
|
-
:members:
|
|
10
|
-
|
|
11
|
-
.. autofunction:: freq
|
|
12
|
-
|
|
13
|
-
.. autofunction:: lb
|
|
14
|
-
|
|
15
|
-
.. autofunction:: static
|
|
16
|
-
|
|
17
|
-
"""
|
|
18
|
-
from __future__ import absolute_import
|
|
19
|
-
|
|
20
|
-
from .analysis import Analysis
|
|
21
|
-
from .freq import freq
|
|
22
|
-
from .linear_buckling import lb
|
|
23
|
-
from .static import solve, static
|
|
1
|
+
r"""
|
|
2
|
+
===============================================
|
|
3
|
+
Structural Analysis Solver (:mod:`structsolve`)
|
|
4
|
+
===============================================
|
|
5
|
+
|
|
6
|
+
.. currentmodule:: structsolve
|
|
7
|
+
|
|
8
|
+
.. autoclass:: Analysis
|
|
9
|
+
:members:
|
|
10
|
+
|
|
11
|
+
.. autofunction:: freq
|
|
12
|
+
|
|
13
|
+
.. autofunction:: lb
|
|
14
|
+
|
|
15
|
+
.. autofunction:: static
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
from .analysis import Analysis
|
|
21
|
+
from .freq import freq
|
|
22
|
+
from .linear_buckling import lb
|
|
23
|
+
from .static import solve, static
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
from __future__ import absolute_import
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
from numpy import dot
|
|
5
|
-
|
|
6
|
-
from .static import solve
|
|
7
|
-
from .logger import msg
|
|
8
|
-
from .newton_raphson import _solver_NR
|
|
9
|
-
from .arc_length_riks import _solver_arc_length_riks
|
|
10
|
-
from .arc_length_crisfield import _solver_arc_length_crisfield
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Analysis(object):
|
|
14
|
-
r"""Class that embodies all data required for linear/non-linear analysis
|
|
15
|
-
|
|
16
|
-
The parameters are described in the following tables:
|
|
17
|
-
|
|
18
|
-
======================== ==================================================
|
|
19
|
-
Non-Linear Algorithm Description
|
|
20
|
-
======================== ==================================================
|
|
21
|
-
``NL_method`` ``str``, ``'NR'`` for the Newton-Raphson
|
|
22
|
-
``'arc_length'`` for the Arc-Length method
|
|
23
|
-
``line_search`` ``bool``, activate line_search (for
|
|
24
|
-
Newton-Raphson methods only)
|
|
25
|
-
``max_iter_line_search`` ``int``, maximum number of iteration attempts
|
|
26
|
-
for the line-search algorithm
|
|
27
|
-
``modified_NR`` ``bool``, activates the modified Newton-Raphson
|
|
28
|
-
``compute_every_n`` ``int``, if ``modified_NR=True``, the non-linear
|
|
29
|
-
matrices will be updated at every `n` iterations
|
|
30
|
-
``kT_initial_state`` ``bool``, tells if the tangent stiffness matrix
|
|
31
|
-
should be calculated already at the initial
|
|
32
|
-
state, which is required for example when
|
|
33
|
-
initial imperfections take place
|
|
34
|
-
======================== ==================================================
|
|
35
|
-
|
|
36
|
-
============== =================================================
|
|
37
|
-
Incrementation Description
|
|
38
|
-
============== =================================================
|
|
39
|
-
``initialInc`` initial load increment size. In the arc-length
|
|
40
|
-
method it will be the initial value for
|
|
41
|
-
`\lambda`
|
|
42
|
-
``minInc`` minimum increment size; if achieved the analysis
|
|
43
|
-
is terminated. The arc-length method will use
|
|
44
|
-
this parameter to terminate when the minimum
|
|
45
|
-
arc-length increment is smaller than ``minInc``
|
|
46
|
-
``maxInc`` maximum increment size
|
|
47
|
-
``maxArcLength`` maximum length covered by the arc-length search
|
|
48
|
-
============== =================================================
|
|
49
|
-
|
|
50
|
-
==================== ============================================
|
|
51
|
-
Convergence Criteria Description
|
|
52
|
-
==================== ============================================
|
|
53
|
-
``absTOL`` the convergence is achieved when the maximum
|
|
54
|
-
residual force is smaller than this value
|
|
55
|
-
``maxNumIter`` maximum number of iteration; if achieved the
|
|
56
|
-
load increment is bisected
|
|
57
|
-
``too_slow_TOL`` tolerance that tells if the convergence is too
|
|
58
|
-
slow
|
|
59
|
-
==================== ============================================
|
|
60
|
-
|
|
61
|
-
Parameters
|
|
62
|
-
----------
|
|
63
|
-
calc_fext : callable, optional
|
|
64
|
-
Must return a 1-D array containing the external forces. Required for
|
|
65
|
-
linear/non-linear static analysis.
|
|
66
|
-
calc_fint : callable, optional
|
|
67
|
-
Must return a 1-D array containing the internal forces. Required for
|
|
68
|
-
non-linear analysis.
|
|
69
|
-
calc_kC : callable, optional
|
|
70
|
-
Must return a sparse matrix containing the constitutive stiffness matrix.
|
|
71
|
-
Required for linear/non-linear static analysis.
|
|
72
|
-
calc_kG : callable, optional
|
|
73
|
-
Must return a sparse matrix containing the geometric stiffness matrix.
|
|
74
|
-
Required for non-linear analysis.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
increments : list
|
|
79
|
-
Each time increment that achieved convergence.
|
|
80
|
-
cs : list
|
|
81
|
-
The solution for each increment.
|
|
82
|
-
|
|
83
|
-
"""
|
|
84
|
-
__slots__ = ['NL_method', 'line_search', 'max_iter_line_search',
|
|
85
|
-
'modified_NR', 'compute_every_n',
|
|
86
|
-
'kT_initial_state', 'initialInc', 'minInc', 'maxInc',
|
|
87
|
-
'maxArcLength', 'absTOL', 'relTOL', 'maxNumIter', 'too_slow_TOL',
|
|
88
|
-
'increments', 'cs', 'last_analysis', 'calc_fext', 'calc_kC',
|
|
89
|
-
'calc_fint', 'calc_kG']
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def __init__(self, calc_fext=None, calc_fint=None, calc_kC=None,
|
|
93
|
-
calc_kG=None):
|
|
94
|
-
# non-linear algorithm
|
|
95
|
-
self.NL_method = 'NR'
|
|
96
|
-
self.line_search = True
|
|
97
|
-
self.max_iter_line_search = 20
|
|
98
|
-
self.modified_NR = True
|
|
99
|
-
self.compute_every_n = 6
|
|
100
|
-
self.kT_initial_state = True
|
|
101
|
-
# incrementation
|
|
102
|
-
self.initialInc = 0.1
|
|
103
|
-
self.minInc = 1.e-4
|
|
104
|
-
self.maxInc = 1.
|
|
105
|
-
self.maxArcLength = 18
|
|
106
|
-
# convergence criteria
|
|
107
|
-
self.absTOL = 1.e-3
|
|
108
|
-
self.relTOL = 1.e-3
|
|
109
|
-
self.maxNumIter = 30
|
|
110
|
-
self.too_slow_TOL = 0.005
|
|
111
|
-
|
|
112
|
-
# required methods
|
|
113
|
-
self.calc_fext = calc_fext
|
|
114
|
-
self.calc_fint = calc_fint
|
|
115
|
-
self.calc_kC = calc_kC
|
|
116
|
-
self.calc_kG = calc_kG
|
|
117
|
-
|
|
118
|
-
# outputs to be filled
|
|
119
|
-
self.increments = None
|
|
120
|
-
self.cs = None
|
|
121
|
-
|
|
122
|
-
# flag telling the last analysis
|
|
123
|
-
self.last_analysis = ''
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def static(self, NLgeom=False, silent=False):
|
|
127
|
-
"""General solver for static analyses
|
|
128
|
-
|
|
129
|
-
Selects the specific solver based on the ``NL_method`` parameter.
|
|
130
|
-
|
|
131
|
-
Parameters
|
|
132
|
-
----------
|
|
133
|
-
|
|
134
|
-
NLgeom : bool
|
|
135
|
-
Flag to indicate whether a linear or a non-linear analysis is to
|
|
136
|
-
be performed.
|
|
137
|
-
silent : bool, optional
|
|
138
|
-
A boolean to tell whether the log messages should be printed.
|
|
139
|
-
|
|
140
|
-
"""
|
|
141
|
-
self.increments = []
|
|
142
|
-
self.cs = []
|
|
143
|
-
|
|
144
|
-
if NLgeom:
|
|
145
|
-
self.maxInc = max(self.initialInc, self.maxInc)
|
|
146
|
-
msg('Started Non-Linear Static Analysis', silent=silent)
|
|
147
|
-
if self.NL_method
|
|
148
|
-
_solver_NR(self, silent=silent)
|
|
149
|
-
elif self.NL_method
|
|
150
|
-
_solver_arc_length_riks(self, silent=silent)
|
|
151
|
-
elif self.NL_method
|
|
152
|
-
_solver_arc_length_crisfield(self, silent=silent)
|
|
153
|
-
else:
|
|
154
|
-
raise ValueError('{0} is an invalid NL_method')
|
|
155
|
-
|
|
156
|
-
else:
|
|
157
|
-
msg('Started Linear Static Analysis', silent=silent)
|
|
158
|
-
fext = self.calc_fext(silent=silent)
|
|
159
|
-
k0 = self.calc_kC(silent=silent)
|
|
160
|
-
|
|
161
|
-
c = solve(k0, fext, silent=silent)
|
|
162
|
-
|
|
163
|
-
self.cs.append(c)
|
|
164
|
-
self.increments.append(1.)
|
|
165
|
-
msg('Finished Linear Static Analysis', silent=silent)
|
|
166
|
-
|
|
167
|
-
self.last_analysis = 'static'
|
|
168
|
-
|
|
169
|
-
return self.increments, self.cs
|
|
170
|
-
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy import dot
|
|
5
|
+
|
|
6
|
+
from .static import solve
|
|
7
|
+
from .logger import msg
|
|
8
|
+
from .newton_raphson import _solver_NR
|
|
9
|
+
from .arc_length_riks import _solver_arc_length_riks
|
|
10
|
+
from .arc_length_crisfield import _solver_arc_length_crisfield
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Analysis(object):
|
|
14
|
+
r"""Class that embodies all data required for linear/non-linear analysis
|
|
15
|
+
|
|
16
|
+
The parameters are described in the following tables:
|
|
17
|
+
|
|
18
|
+
======================== ==================================================
|
|
19
|
+
Non-Linear Algorithm Description
|
|
20
|
+
======================== ==================================================
|
|
21
|
+
``NL_method`` ``str``, ``'NR'`` for the Newton-Raphson
|
|
22
|
+
``'arc_length'`` for the Arc-Length method
|
|
23
|
+
``line_search`` ``bool``, activate line_search (for
|
|
24
|
+
Newton-Raphson methods only)
|
|
25
|
+
``max_iter_line_search`` ``int``, maximum number of iteration attempts
|
|
26
|
+
for the line-search algorithm
|
|
27
|
+
``modified_NR`` ``bool``, activates the modified Newton-Raphson
|
|
28
|
+
``compute_every_n`` ``int``, if ``modified_NR=True``, the non-linear
|
|
29
|
+
matrices will be updated at every `n` iterations
|
|
30
|
+
``kT_initial_state`` ``bool``, tells if the tangent stiffness matrix
|
|
31
|
+
should be calculated already at the initial
|
|
32
|
+
state, which is required for example when
|
|
33
|
+
initial imperfections take place
|
|
34
|
+
======================== ==================================================
|
|
35
|
+
|
|
36
|
+
============== =================================================
|
|
37
|
+
Incrementation Description
|
|
38
|
+
============== =================================================
|
|
39
|
+
``initialInc`` initial load increment size. In the arc-length
|
|
40
|
+
method it will be the initial value for
|
|
41
|
+
`\lambda`
|
|
42
|
+
``minInc`` minimum increment size; if achieved the analysis
|
|
43
|
+
is terminated. The arc-length method will use
|
|
44
|
+
this parameter to terminate when the minimum
|
|
45
|
+
arc-length increment is smaller than ``minInc``
|
|
46
|
+
``maxInc`` maximum increment size
|
|
47
|
+
``maxArcLength`` maximum length covered by the arc-length search
|
|
48
|
+
============== =================================================
|
|
49
|
+
|
|
50
|
+
==================== ============================================
|
|
51
|
+
Convergence Criteria Description
|
|
52
|
+
==================== ============================================
|
|
53
|
+
``absTOL`` the convergence is achieved when the maximum
|
|
54
|
+
residual force is smaller than this value
|
|
55
|
+
``maxNumIter`` maximum number of iteration; if achieved the
|
|
56
|
+
load increment is bisected
|
|
57
|
+
``too_slow_TOL`` tolerance that tells if the convergence is too
|
|
58
|
+
slow
|
|
59
|
+
==================== ============================================
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
calc_fext : callable, optional
|
|
64
|
+
Must return a 1-D array containing the external forces. Required for
|
|
65
|
+
linear/non-linear static analysis.
|
|
66
|
+
calc_fint : callable, optional
|
|
67
|
+
Must return a 1-D array containing the internal forces. Required for
|
|
68
|
+
non-linear analysis.
|
|
69
|
+
calc_kC : callable, optional
|
|
70
|
+
Must return a sparse matrix containing the constitutive stiffness matrix.
|
|
71
|
+
Required for linear/non-linear static analysis.
|
|
72
|
+
calc_kG : callable, optional
|
|
73
|
+
Must return a sparse matrix containing the geometric stiffness matrix.
|
|
74
|
+
Required for non-linear analysis.
|
|
75
|
+
|
|
76
|
+
Returns
|
|
77
|
+
-------
|
|
78
|
+
increments : list
|
|
79
|
+
Each time increment that achieved convergence.
|
|
80
|
+
cs : list
|
|
81
|
+
The solution for each increment.
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
__slots__ = ['NL_method', 'line_search', 'max_iter_line_search',
|
|
85
|
+
'modified_NR', 'compute_every_n',
|
|
86
|
+
'kT_initial_state', 'initialInc', 'minInc', 'maxInc',
|
|
87
|
+
'maxArcLength', 'absTOL', 'relTOL', 'maxNumIter', 'too_slow_TOL',
|
|
88
|
+
'increments', 'cs', 'last_analysis', 'calc_fext', 'calc_kC',
|
|
89
|
+
'calc_fint', 'calc_kG']
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def __init__(self, calc_fext=None, calc_fint=None, calc_kC=None,
|
|
93
|
+
calc_kG=None):
|
|
94
|
+
# non-linear algorithm
|
|
95
|
+
self.NL_method = 'NR'
|
|
96
|
+
self.line_search = True
|
|
97
|
+
self.max_iter_line_search = 20
|
|
98
|
+
self.modified_NR = True
|
|
99
|
+
self.compute_every_n = 6
|
|
100
|
+
self.kT_initial_state = True
|
|
101
|
+
# incrementation
|
|
102
|
+
self.initialInc = 0.1
|
|
103
|
+
self.minInc = 1.e-4
|
|
104
|
+
self.maxInc = 1.
|
|
105
|
+
self.maxArcLength = 18
|
|
106
|
+
# convergence criteria
|
|
107
|
+
self.absTOL = 1.e-3
|
|
108
|
+
self.relTOL = 1.e-3
|
|
109
|
+
self.maxNumIter = 30
|
|
110
|
+
self.too_slow_TOL = 0.005
|
|
111
|
+
|
|
112
|
+
# required methods
|
|
113
|
+
self.calc_fext = calc_fext
|
|
114
|
+
self.calc_fint = calc_fint
|
|
115
|
+
self.calc_kC = calc_kC
|
|
116
|
+
self.calc_kG = calc_kG
|
|
117
|
+
|
|
118
|
+
# outputs to be filled
|
|
119
|
+
self.increments = None
|
|
120
|
+
self.cs = None
|
|
121
|
+
|
|
122
|
+
# flag telling the last analysis
|
|
123
|
+
self.last_analysis = ''
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def static(self, NLgeom=False, silent=False):
|
|
127
|
+
"""General solver for static analyses
|
|
128
|
+
|
|
129
|
+
Selects the specific solver based on the ``NL_method`` parameter.
|
|
130
|
+
|
|
131
|
+
Parameters
|
|
132
|
+
----------
|
|
133
|
+
|
|
134
|
+
NLgeom : bool
|
|
135
|
+
Flag to indicate whether a linear or a non-linear analysis is to
|
|
136
|
+
be performed.
|
|
137
|
+
silent : bool, optional
|
|
138
|
+
A boolean to tell whether the log messages should be printed.
|
|
139
|
+
|
|
140
|
+
"""
|
|
141
|
+
self.increments = []
|
|
142
|
+
self.cs = []
|
|
143
|
+
|
|
144
|
+
if NLgeom:
|
|
145
|
+
self.maxInc = max(self.initialInc, self.maxInc)
|
|
146
|
+
msg('Started Non-Linear Static Analysis', silent=silent)
|
|
147
|
+
if self.NL_method == 'NR':
|
|
148
|
+
_solver_NR(self, silent=silent)
|
|
149
|
+
elif self.NL_method == 'arc_length_riks':
|
|
150
|
+
_solver_arc_length_riks(self, silent=silent)
|
|
151
|
+
elif self.NL_method == 'arc_length_crisfield':
|
|
152
|
+
_solver_arc_length_crisfield(self, silent=silent)
|
|
153
|
+
else:
|
|
154
|
+
raise ValueError('{0} is an invalid NL_method')
|
|
155
|
+
|
|
156
|
+
else:
|
|
157
|
+
msg('Started Linear Static Analysis', silent=silent)
|
|
158
|
+
fext = self.calc_fext(silent=silent)
|
|
159
|
+
k0 = self.calc_kC(silent=silent)
|
|
160
|
+
|
|
161
|
+
c = solve(k0, fext, silent=silent)
|
|
162
|
+
|
|
163
|
+
self.cs.append(c)
|
|
164
|
+
self.increments.append(1.)
|
|
165
|
+
msg('Finished Linear Static Analysis', silent=silent)
|
|
166
|
+
|
|
167
|
+
self.last_analysis = 'static'
|
|
168
|
+
|
|
169
|
+
return self.increments, self.cs
|
|
170
|
+
|