cronos-mcpp 5.0.0__cp313-cp313-win_amd64.whl
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.
- cronos.cp313-win_amd64.pyd +0 -0
- cronos.pyi +3820 -0
- cronos_mcpp-5.0.0.data/platlib/amd-56a2e72b4e14a69ca8702378cc8a3847.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/btf-71cd91a57f3337d6fe00090f31d955e4.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/colamd-52fcbf188e1e495a4e989e56150c3e2d.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/klu-66ce96272f68f3906023da73f5c04482.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/libopenblas-c63be9f939bfce8a1ebc04eac0fa1f13.dll +4 -0
- cronos_mcpp-5.0.0.data/platlib/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/suitesparseconfig-6856ba499fd38969656edded74fd21c9.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/sundials_core-bbd8a15571204e0913d1ad7603d9699e.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/sundials_cvodes-7a1444312176bf8d7c41fd7ba754f8b5.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/sundials_sunlinsolklu-134cd12be72fcc408a8a3835531c71a0.dll +0 -0
- cronos_mcpp-5.0.0.data/platlib/sundials_sunmatrixsparse-cee352b5607a32135234cff65112eb6a.dll +0 -0
- cronos_mcpp-5.0.0.dist-info/DELVEWHEEL +2 -0
- cronos_mcpp-5.0.0.dist-info/METADATA +122 -0
- cronos_mcpp-5.0.0.dist-info/RECORD +19 -0
- cronos_mcpp-5.0.0.dist-info/WHEEL +5 -0
- cronos_mcpp-5.0.0.dist-info/licenses/LICENSE +101 -0
- cronos_mcpp-5.0.0.dist-info/licenses/THIRD_PARTY_NOTICES.txt +3995 -0
cronos.pyi
ADDED
|
@@ -0,0 +1,3820 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python interface of CRONOS: models of differential-algebraic systems on the DAG of MC++ (``FFModel``), and their
|
|
3
|
+
solvers -- ``ODESLV`` (CVODES, with forward and adjoint sensitivities) and ``OCFESLV`` (orthogonal collocation on
|
|
4
|
+
finite elements) -- plus their embedding as DAG operations (``FFODESLV``, ``FFOCFESLV``, ``FFOCFERES``).
|
|
5
|
+
|
|
6
|
+
The DAG types (``FFGraph``, ``FFVar``, ``FFOp``) and the operators ``FFPartial``, ``FFIntegral``, ``FFEval`` come
|
|
7
|
+
from ``pymcpp``, which this module imports.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
import collections.abc
|
|
11
|
+
import enum
|
|
12
|
+
import numpy
|
|
13
|
+
import numpy.typing
|
|
14
|
+
import pymcpp
|
|
15
|
+
import typing
|
|
16
|
+
__all__: list[str] = ['FFDom', 'FFGradOCFERES', 'FFGradOCFESLV', 'FFGradODESLV', 'FFModel', 'FFOCFERES', 'FFOCFESLV', 'FFODESLV', 'OCFESLV', 'ODESLV', 'build_info']
|
|
17
|
+
class FFDom:
|
|
18
|
+
"""
|
|
19
|
+
Domain of an independent variable: bounds, finite elements, and the
|
|
20
|
+
collocation node family and count per element. Passed to
|
|
21
|
+
``FFModel.add_domain`` (and to ``add_input`` for an input's own node family).
|
|
22
|
+
|
|
23
|
+
Its enumerations double as the masks and sides used elsewhere:
|
|
24
|
+
|
|
25
|
+
- ``DOM``: ``ALL`` (the closed domain [a,b]), ``LB`` (a) and ``UB`` (b); masks
|
|
26
|
+
combine by arithmetic, e.g. ``FFDom.ALL - FFDom.LB`` is (a,b];
|
|
27
|
+
- ``SIDE``: ``MINUS`` (tau^-, default) and ``PLUS`` (tau^+), for one-sided
|
|
28
|
+
evaluations;
|
|
29
|
+
- ``TYPE``: ``LG``, ``LGR``, ``LGL``, ``CGL`` node families.
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
|
|
33
|
+
>>> from cronos import FFDom
|
|
34
|
+
>>> T = FFDom(0., 1., 10, FFDom.LGR, 4) # 10 elements, 4 Radau nodes each
|
|
35
|
+
>>> Z = FFDom([0., .2, 1.], FFDom.LGL, 6) # 2 elements from boundaries
|
|
36
|
+
"""
|
|
37
|
+
class DOM(enum.IntEnum):
|
|
38
|
+
"""
|
|
39
|
+
Domain masks for equations and outputs.
|
|
40
|
+
"""
|
|
41
|
+
ALL: typing.ClassVar[FFDom.DOM]
|
|
42
|
+
LB: typing.ClassVar[FFDom.DOM]
|
|
43
|
+
UB: typing.ClassVar[FFDom.DOM]
|
|
44
|
+
@classmethod
|
|
45
|
+
def __new__(cls, value):
|
|
46
|
+
...
|
|
47
|
+
def __format__(self, format_spec):
|
|
48
|
+
"""
|
|
49
|
+
Convert to a string according to format_spec.
|
|
50
|
+
"""
|
|
51
|
+
class SIDE:
|
|
52
|
+
"""
|
|
53
|
+
Side of a point evaluation.
|
|
54
|
+
|
|
55
|
+
Members:
|
|
56
|
+
|
|
57
|
+
MINUS : tau^-: the end of the element ending at tau (default)
|
|
58
|
+
|
|
59
|
+
PLUS : tau^+: the start of the element starting at tau
|
|
60
|
+
"""
|
|
61
|
+
MINUS: typing.ClassVar[FFDom.SIDE]
|
|
62
|
+
PLUS: typing.ClassVar[FFDom.SIDE]
|
|
63
|
+
__members__: typing.ClassVar[dict[str, FFDom.SIDE]]
|
|
64
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
65
|
+
...
|
|
66
|
+
def __getstate__(self) -> int:
|
|
67
|
+
...
|
|
68
|
+
def __hash__(self) -> int:
|
|
69
|
+
...
|
|
70
|
+
def __index__(self) -> int:
|
|
71
|
+
...
|
|
72
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
73
|
+
...
|
|
74
|
+
def __int__(self) -> int:
|
|
75
|
+
...
|
|
76
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
77
|
+
...
|
|
78
|
+
def __repr__(self) -> str:
|
|
79
|
+
...
|
|
80
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
81
|
+
...
|
|
82
|
+
def __str__(self) -> str:
|
|
83
|
+
...
|
|
84
|
+
@property
|
|
85
|
+
def name(self) -> str:
|
|
86
|
+
...
|
|
87
|
+
@property
|
|
88
|
+
def value(self) -> int:
|
|
89
|
+
...
|
|
90
|
+
class TYPE:
|
|
91
|
+
"""
|
|
92
|
+
Collocation node family.
|
|
93
|
+
|
|
94
|
+
Members:
|
|
95
|
+
|
|
96
|
+
LG : Legendre-Gauss
|
|
97
|
+
|
|
98
|
+
LGR : Legendre-Gauss-Radau, left endpoint included
|
|
99
|
+
|
|
100
|
+
LGL : Legendre-Gauss-Lobatto, both endpoints included
|
|
101
|
+
|
|
102
|
+
CGL : Chebyshev-Gauss-Lobatto, both endpoints included
|
|
103
|
+
"""
|
|
104
|
+
CGL: typing.ClassVar[FFDom.TYPE]
|
|
105
|
+
LG: typing.ClassVar[FFDom.TYPE]
|
|
106
|
+
LGL: typing.ClassVar[FFDom.TYPE]
|
|
107
|
+
LGR: typing.ClassVar[FFDom.TYPE]
|
|
108
|
+
__members__: typing.ClassVar[dict[str, FFDom.TYPE]]
|
|
109
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
110
|
+
...
|
|
111
|
+
def __getstate__(self) -> int:
|
|
112
|
+
...
|
|
113
|
+
def __hash__(self) -> int:
|
|
114
|
+
...
|
|
115
|
+
def __index__(self) -> int:
|
|
116
|
+
...
|
|
117
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
118
|
+
...
|
|
119
|
+
def __int__(self) -> int:
|
|
120
|
+
...
|
|
121
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
122
|
+
...
|
|
123
|
+
def __repr__(self) -> str:
|
|
124
|
+
...
|
|
125
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
126
|
+
...
|
|
127
|
+
def __str__(self) -> str:
|
|
128
|
+
...
|
|
129
|
+
@property
|
|
130
|
+
def name(self) -> str:
|
|
131
|
+
...
|
|
132
|
+
@property
|
|
133
|
+
def value(self) -> int:
|
|
134
|
+
...
|
|
135
|
+
class Exceptions:
|
|
136
|
+
"""
|
|
137
|
+
Exception information for errors raised while defining a domain.
|
|
138
|
+
|
|
139
|
+
Instances carry an error code (ierr) and a human-readable description (what).
|
|
140
|
+
"""
|
|
141
|
+
class TYPE:
|
|
142
|
+
"""
|
|
143
|
+
Error codes for FFDom exceptions
|
|
144
|
+
|
|
145
|
+
Members:
|
|
146
|
+
|
|
147
|
+
BOUNDS : Invalid domain bounds
|
|
148
|
+
|
|
149
|
+
ELEMENTS : Invalid number of elements
|
|
150
|
+
|
|
151
|
+
NODES : Invalid number of collocation points
|
|
152
|
+
|
|
153
|
+
UNDEF : Undefined
|
|
154
|
+
"""
|
|
155
|
+
BOUNDS: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
156
|
+
ELEMENTS: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
157
|
+
NODES: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
158
|
+
UNDEF: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
159
|
+
__members__: typing.ClassVar[dict[str, FFDom.Exceptions.TYPE]]
|
|
160
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
161
|
+
...
|
|
162
|
+
def __getstate__(self) -> int:
|
|
163
|
+
...
|
|
164
|
+
def __hash__(self) -> int:
|
|
165
|
+
...
|
|
166
|
+
def __index__(self) -> int:
|
|
167
|
+
...
|
|
168
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
169
|
+
...
|
|
170
|
+
def __int__(self) -> int:
|
|
171
|
+
...
|
|
172
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
173
|
+
...
|
|
174
|
+
def __repr__(self) -> str:
|
|
175
|
+
...
|
|
176
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
177
|
+
...
|
|
178
|
+
def __str__(self) -> str:
|
|
179
|
+
...
|
|
180
|
+
@property
|
|
181
|
+
def name(self) -> str:
|
|
182
|
+
...
|
|
183
|
+
@property
|
|
184
|
+
def value(self) -> int:
|
|
185
|
+
...
|
|
186
|
+
BOUNDS: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
187
|
+
ELEMENTS: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
188
|
+
NODES: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
189
|
+
UNDEF: typing.ClassVar[FFDom.Exceptions.TYPE]
|
|
190
|
+
def ierr(self) -> int:
|
|
191
|
+
"""
|
|
192
|
+
Return the error code as an integer (see FFDom.Exceptions.TYPE).
|
|
193
|
+
"""
|
|
194
|
+
def what(self) -> str:
|
|
195
|
+
"""
|
|
196
|
+
Return a string describing the error.
|
|
197
|
+
"""
|
|
198
|
+
ALL: typing.ClassVar[FFDom.DOM]
|
|
199
|
+
CGL: typing.ClassVar[FFDom.TYPE]
|
|
200
|
+
LB: typing.ClassVar[FFDom.DOM]
|
|
201
|
+
LG: typing.ClassVar[FFDom.TYPE]
|
|
202
|
+
LGL: typing.ClassVar[FFDom.TYPE]
|
|
203
|
+
LGR: typing.ClassVar[FFDom.TYPE]
|
|
204
|
+
MINUS: typing.ClassVar[FFDom.SIDE]
|
|
205
|
+
PLUS: typing.ClassVar[FFDom.SIDE]
|
|
206
|
+
UB: typing.ClassVar[FFDom.DOM]
|
|
207
|
+
@typing.overload
|
|
208
|
+
def __init__(self) -> None:
|
|
209
|
+
"""
|
|
210
|
+
Empty domain.
|
|
211
|
+
"""
|
|
212
|
+
@typing.overload
|
|
213
|
+
def __init__(self, lo: typing.SupportsFloat | typing.SupportsIndex, up: typing.SupportsFloat | typing.SupportsIndex, n_elem: typing.SupportsInt | typing.SupportsIndex = 1, type: FFDom.TYPE = ..., n_node: typing.SupportsInt | typing.SupportsIndex = 4) -> None:
|
|
214
|
+
"""
|
|
215
|
+
Uniform finite elements on [lo, up] (one element by default).
|
|
216
|
+
"""
|
|
217
|
+
@typing.overload
|
|
218
|
+
def __init__(self, elem_bnd: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], type: FFDom.TYPE = ..., n_node: typing.SupportsInt | typing.SupportsIndex = 4) -> None:
|
|
219
|
+
"""
|
|
220
|
+
Finite elements from their boundaries (size n_elem+1).
|
|
221
|
+
"""
|
|
222
|
+
@typing.overload
|
|
223
|
+
def __init__(self, lo: typing.SupportsFloat | typing.SupportsIndex, elem_len: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], type: FFDom.TYPE = ..., n_node: typing.SupportsInt | typing.SupportsIndex = 4) -> None:
|
|
224
|
+
"""
|
|
225
|
+
Finite elements from the lower bound and the element lengths.
|
|
226
|
+
"""
|
|
227
|
+
@typing.overload
|
|
228
|
+
def __init__(self, other: FFDom) -> None:
|
|
229
|
+
"""
|
|
230
|
+
Copy.
|
|
231
|
+
"""
|
|
232
|
+
def __repr__(self) -> str:
|
|
233
|
+
...
|
|
234
|
+
def elem_lo(self, iel: typing.SupportsInt | typing.SupportsIndex) -> float:
|
|
235
|
+
"""
|
|
236
|
+
Lower bound of element ``iel``.
|
|
237
|
+
"""
|
|
238
|
+
def elem_up(self, iel: typing.SupportsInt | typing.SupportsIndex) -> float:
|
|
239
|
+
"""
|
|
240
|
+
Upper bound of element ``iel``.
|
|
241
|
+
"""
|
|
242
|
+
def elem_width(self, iel: typing.SupportsInt | typing.SupportsIndex) -> float:
|
|
243
|
+
"""
|
|
244
|
+
Length of element ``iel``.
|
|
245
|
+
"""
|
|
246
|
+
def uniform(self) -> bool:
|
|
247
|
+
"""
|
|
248
|
+
True if all elements have the same length (to tolerance).
|
|
249
|
+
"""
|
|
250
|
+
@property
|
|
251
|
+
def elem_bnd(self) -> list[float]:
|
|
252
|
+
"""
|
|
253
|
+
Element boundaries, size n_elem+1.
|
|
254
|
+
"""
|
|
255
|
+
@property
|
|
256
|
+
def elem_len(self) -> list[float]:
|
|
257
|
+
"""
|
|
258
|
+
Element lengths, size n_elem.
|
|
259
|
+
"""
|
|
260
|
+
@property
|
|
261
|
+
def lo_dom(self) -> float:
|
|
262
|
+
"""
|
|
263
|
+
Lower bound.
|
|
264
|
+
"""
|
|
265
|
+
@property
|
|
266
|
+
def n_elem(self) -> int:
|
|
267
|
+
"""
|
|
268
|
+
Number of finite elements.
|
|
269
|
+
"""
|
|
270
|
+
@property
|
|
271
|
+
def n_node(self) -> int:
|
|
272
|
+
"""
|
|
273
|
+
Number of collocation nodes per element.
|
|
274
|
+
"""
|
|
275
|
+
@property
|
|
276
|
+
def type(self) -> FFDom.TYPE:
|
|
277
|
+
"""
|
|
278
|
+
Collocation node family.
|
|
279
|
+
"""
|
|
280
|
+
@property
|
|
281
|
+
def up_dom(self) -> float:
|
|
282
|
+
"""
|
|
283
|
+
Upper bound.
|
|
284
|
+
"""
|
|
285
|
+
class FFModel:
|
|
286
|
+
"""
|
|
287
|
+
Model of a differential-algebraic system on the DAG of MC++, shared by the
|
|
288
|
+
CRONOS solvers.
|
|
289
|
+
|
|
290
|
+
A model is declared on an ``FFGraph``: domains of the independent variables
|
|
291
|
+
(``add_domain``, with an ``FFDom``), states and inputs over subsets of these
|
|
292
|
+
domains, constants, equations with a region (masks per domain) and a role,
|
|
293
|
+
outputs (point values, integrals, or distributed values), and transitions
|
|
294
|
+
(jumps of the states at an interior point of the evolution domain).
|
|
295
|
+
``setup()`` validates and analyses the model; the solvers (``ODESLV``,
|
|
296
|
+
``OCFESLV``) derive from ``FFModel`` and call it themselves.
|
|
297
|
+
|
|
298
|
+
Example -- the scalar ODE x' = -k x, x(0) = 1, output x(1):
|
|
299
|
+
|
|
300
|
+
>>> from pymcpp import FFGraph, FFPartial, FFEval
|
|
301
|
+
>>> from cronos import FFDom, FFModel, ODESLV
|
|
302
|
+
>>> G = FFGraph(); t, x = G.add_var("t"), G.add_var("x")
|
|
303
|
+
>>> OpP, OpE = FFPartial(), FFEval()
|
|
304
|
+
>>> M = ODESLV(G)
|
|
305
|
+
>>> M.add_domain(t, FFDom(0., 1., 1)); M.set_evolution_domain(t)
|
|
306
|
+
>>> M.add_state(x, [t])
|
|
307
|
+
>>> M.add_equation(OpP(x, t) + .7*x, [t], [FFDom.ALL - FFDom.LB])
|
|
308
|
+
>>> M.add_equation(x - 1., [t], [FFDom.LB])
|
|
309
|
+
>>> M.add_output(OpE(x, t, 1.))
|
|
310
|
+
"""
|
|
311
|
+
class DofIndex:
|
|
312
|
+
"""
|
|
313
|
+
Position of one degree of freedom of a distributed input: its element and its
|
|
314
|
+
node within the element, per domain.
|
|
315
|
+
"""
|
|
316
|
+
def __init__(self) -> None:
|
|
317
|
+
...
|
|
318
|
+
@property
|
|
319
|
+
def element(self) -> dict[pymcpp.FFVar, int]:
|
|
320
|
+
"""
|
|
321
|
+
Element index per domain, ``{domain: element}``.
|
|
322
|
+
"""
|
|
323
|
+
@element.setter
|
|
324
|
+
def element(self, arg0: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsInt | typing.SupportsIndex]) -> None:
|
|
325
|
+
...
|
|
326
|
+
@property
|
|
327
|
+
def node(self) -> dict[pymcpp.FFVar, int]:
|
|
328
|
+
"""
|
|
329
|
+
Node index within the element per domain, ``{domain: node}``.
|
|
330
|
+
"""
|
|
331
|
+
@node.setter
|
|
332
|
+
def node(self, arg0: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsInt | typing.SupportsIndex]) -> None:
|
|
333
|
+
...
|
|
334
|
+
class Exceptions:
|
|
335
|
+
"""
|
|
336
|
+
Exception information for errors raised by a model or its solvers (the same
|
|
337
|
+
type as OCFESLV.Exceptions).
|
|
338
|
+
|
|
339
|
+
Instances carry an error code (ierr) and a human-readable description (what).
|
|
340
|
+
"""
|
|
341
|
+
class TYPE:
|
|
342
|
+
"""
|
|
343
|
+
Error codes for FFModel exceptions
|
|
344
|
+
|
|
345
|
+
Members:
|
|
346
|
+
|
|
347
|
+
SETUP : Incomplete setup before evaluation
|
|
348
|
+
|
|
349
|
+
INDEX : Index mismatch in data access
|
|
350
|
+
|
|
351
|
+
DOMAIN : Variable-domain misspecification in expression
|
|
352
|
+
|
|
353
|
+
ENV : Environment mismatch in collocation operation
|
|
354
|
+
|
|
355
|
+
CSTVAL : Undefined constant values
|
|
356
|
+
|
|
357
|
+
UNDEF : Undefined collocation operation
|
|
358
|
+
|
|
359
|
+
INTERNAL : Internal error
|
|
360
|
+
|
|
361
|
+
NOSTORE : No stored solution available for a buffer-free read
|
|
362
|
+
"""
|
|
363
|
+
CSTVAL: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
364
|
+
DOMAIN: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
365
|
+
ENV: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
366
|
+
INDEX: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
367
|
+
INTERNAL: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
368
|
+
NOSTORE: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
369
|
+
SETUP: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
370
|
+
UNDEF: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
371
|
+
__members__: typing.ClassVar[dict[str, FFModel.Exceptions.TYPE]]
|
|
372
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
373
|
+
...
|
|
374
|
+
def __getstate__(self) -> int:
|
|
375
|
+
...
|
|
376
|
+
def __hash__(self) -> int:
|
|
377
|
+
...
|
|
378
|
+
def __index__(self) -> int:
|
|
379
|
+
...
|
|
380
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
381
|
+
...
|
|
382
|
+
def __int__(self) -> int:
|
|
383
|
+
...
|
|
384
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
385
|
+
...
|
|
386
|
+
def __repr__(self) -> str:
|
|
387
|
+
...
|
|
388
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
389
|
+
...
|
|
390
|
+
def __str__(self) -> str:
|
|
391
|
+
...
|
|
392
|
+
@property
|
|
393
|
+
def name(self) -> str:
|
|
394
|
+
...
|
|
395
|
+
@property
|
|
396
|
+
def value(self) -> int:
|
|
397
|
+
...
|
|
398
|
+
CSTVAL: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
399
|
+
DOMAIN: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
400
|
+
ENV: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
401
|
+
INDEX: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
402
|
+
INTERNAL: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
403
|
+
NOSTORE: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
404
|
+
SETUP: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
405
|
+
UNDEF: typing.ClassVar[FFModel.Exceptions.TYPE]
|
|
406
|
+
def ierr(self) -> int:
|
|
407
|
+
"""
|
|
408
|
+
Return the error code as an integer (see FFModel.Exceptions.TYPE).
|
|
409
|
+
"""
|
|
410
|
+
def what(self) -> str:
|
|
411
|
+
"""
|
|
412
|
+
Return a string describing the error.
|
|
413
|
+
"""
|
|
414
|
+
class EqnRole:
|
|
415
|
+
"""
|
|
416
|
+
Role of an equation.
|
|
417
|
+
|
|
418
|
+
Members:
|
|
419
|
+
|
|
420
|
+
AUTO : resolved on add: BOUNDARY if some domain mask is LB or UB alone, else INTERIOR
|
|
421
|
+
|
|
422
|
+
INTERIOR : volume/interior PDE or algebraic residual
|
|
423
|
+
|
|
424
|
+
INITIAL : initial-condition trace residual
|
|
425
|
+
|
|
426
|
+
BOUNDARY : exterior boundary-condition trace residual
|
|
427
|
+
|
|
428
|
+
INTERFACE : user-supplied transmission residual between physical subdomains
|
|
429
|
+
|
|
430
|
+
LINK : auxiliary first-order link equation generated by order reduction
|
|
431
|
+
|
|
432
|
+
SURFACE : residual posed on a lower-dimensional boundary or interface
|
|
433
|
+
|
|
434
|
+
DIAGNOSTIC : evaluated only: not classified, receives no SAT, never donated
|
|
435
|
+
"""
|
|
436
|
+
AUTO: typing.ClassVar[FFModel.EqnRole]
|
|
437
|
+
BOUNDARY: typing.ClassVar[FFModel.EqnRole]
|
|
438
|
+
DIAGNOSTIC: typing.ClassVar[FFModel.EqnRole]
|
|
439
|
+
INITIAL: typing.ClassVar[FFModel.EqnRole]
|
|
440
|
+
INTERFACE: typing.ClassVar[FFModel.EqnRole]
|
|
441
|
+
INTERIOR: typing.ClassVar[FFModel.EqnRole]
|
|
442
|
+
LINK: typing.ClassVar[FFModel.EqnRole]
|
|
443
|
+
SURFACE: typing.ClassVar[FFModel.EqnRole]
|
|
444
|
+
__members__: typing.ClassVar[dict[str, FFModel.EqnRole]]
|
|
445
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
446
|
+
...
|
|
447
|
+
def __getstate__(self) -> int:
|
|
448
|
+
...
|
|
449
|
+
def __hash__(self) -> int:
|
|
450
|
+
...
|
|
451
|
+
def __index__(self) -> int:
|
|
452
|
+
...
|
|
453
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
454
|
+
...
|
|
455
|
+
def __int__(self) -> int:
|
|
456
|
+
...
|
|
457
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
458
|
+
...
|
|
459
|
+
def __repr__(self) -> str:
|
|
460
|
+
...
|
|
461
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
462
|
+
...
|
|
463
|
+
def __str__(self) -> str:
|
|
464
|
+
...
|
|
465
|
+
@property
|
|
466
|
+
def name(self) -> str:
|
|
467
|
+
...
|
|
468
|
+
@property
|
|
469
|
+
def value(self) -> int:
|
|
470
|
+
...
|
|
471
|
+
class InputContinuity:
|
|
472
|
+
"""
|
|
473
|
+
Continuity of a distributed input across element interfaces.
|
|
474
|
+
|
|
475
|
+
Members:
|
|
476
|
+
|
|
477
|
+
DISCONTINUOUS : default: the input may jump across element interfaces
|
|
478
|
+
|
|
479
|
+
CONTINUOUS_C0 : the input value matches across interfaces (C0)
|
|
480
|
+
|
|
481
|
+
SMOOTH_C1 : value and first derivative match across interfaces (C1)
|
|
482
|
+
"""
|
|
483
|
+
CONTINUOUS_C0: typing.ClassVar[FFModel.InputContinuity]
|
|
484
|
+
DISCONTINUOUS: typing.ClassVar[FFModel.InputContinuity]
|
|
485
|
+
SMOOTH_C1: typing.ClassVar[FFModel.InputContinuity]
|
|
486
|
+
__members__: typing.ClassVar[dict[str, FFModel.InputContinuity]]
|
|
487
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
488
|
+
...
|
|
489
|
+
def __getstate__(self) -> int:
|
|
490
|
+
...
|
|
491
|
+
def __hash__(self) -> int:
|
|
492
|
+
...
|
|
493
|
+
def __index__(self) -> int:
|
|
494
|
+
...
|
|
495
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
496
|
+
...
|
|
497
|
+
def __int__(self) -> int:
|
|
498
|
+
...
|
|
499
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
500
|
+
...
|
|
501
|
+
def __repr__(self) -> str:
|
|
502
|
+
...
|
|
503
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
504
|
+
...
|
|
505
|
+
def __str__(self) -> str:
|
|
506
|
+
...
|
|
507
|
+
@property
|
|
508
|
+
def name(self) -> str:
|
|
509
|
+
...
|
|
510
|
+
@property
|
|
511
|
+
def value(self) -> int:
|
|
512
|
+
...
|
|
513
|
+
class SetupStatus:
|
|
514
|
+
"""
|
|
515
|
+
Outcome of setup().
|
|
516
|
+
|
|
517
|
+
Members:
|
|
518
|
+
|
|
519
|
+
OK : setup succeeded
|
|
520
|
+
|
|
521
|
+
INCONSISTENT_MODEL : the declared model is inconsistent
|
|
522
|
+
|
|
523
|
+
NODE_SETUP_FAILED : collocation node setup failed
|
|
524
|
+
|
|
525
|
+
CLASSIFICATION_FAILED : PDE classification failed
|
|
526
|
+
|
|
527
|
+
HYP_INCOMING_BC : hyperbolic block: incoming boundary condition missing
|
|
528
|
+
|
|
529
|
+
HYP_BC_MISDIRECTED : hyperbolic block: boundary condition on an outgoing characteristic
|
|
530
|
+
|
|
531
|
+
BACKEND_UNAVAILABLE : an option requests a linear-algebra backend this build does not include
|
|
532
|
+
|
|
533
|
+
HYP_CLOSURE_MISSING : hyperbolic block: AUTO.HYP_CLOSURE off and outflow rows missing
|
|
534
|
+
|
|
535
|
+
REDUCED_DOF_INCONSISTENT : post-index-reduction DOF audit: IC/BC count inconsistent with the reduced degrees of freedom
|
|
536
|
+
|
|
537
|
+
EVOLUTION_DOMAIN_UNSUITABLE : evolution-domain validation: unsuitable evolution domain, or initial condition not settable
|
|
538
|
+
|
|
539
|
+
DETERMINACY_UNDETERMINED : determinacy audit: the Jacobian has a null space with state content
|
|
540
|
+
|
|
541
|
+
MODEL_COPY_FAILED : could not copy the user model into the working DAG
|
|
542
|
+
|
|
543
|
+
CAPTURE_NESTED_REFUSED : nested evolution-direction reduction refused (captured value feeds an outer in-solve operand)
|
|
544
|
+
|
|
545
|
+
INTERFACE_PLAN_INVALID : the interface plan is invalid
|
|
546
|
+
|
|
547
|
+
AUDIT_NONSQUARE : the discretised system is not square
|
|
548
|
+
|
|
549
|
+
DERIV_CACHE_FAILED : derivative cache construction failed
|
|
550
|
+
|
|
551
|
+
LINEAR_CACHE_FAILED : linear-evaluation cache construction failed
|
|
552
|
+
"""
|
|
553
|
+
AUDIT_NONSQUARE: typing.ClassVar[FFModel.SetupStatus]
|
|
554
|
+
BACKEND_UNAVAILABLE: typing.ClassVar[FFModel.SetupStatus]
|
|
555
|
+
CAPTURE_NESTED_REFUSED: typing.ClassVar[FFModel.SetupStatus]
|
|
556
|
+
CLASSIFICATION_FAILED: typing.ClassVar[FFModel.SetupStatus]
|
|
557
|
+
DERIV_CACHE_FAILED: typing.ClassVar[FFModel.SetupStatus]
|
|
558
|
+
DETERMINACY_UNDETERMINED: typing.ClassVar[FFModel.SetupStatus]
|
|
559
|
+
EVOLUTION_DOMAIN_UNSUITABLE: typing.ClassVar[FFModel.SetupStatus]
|
|
560
|
+
HYP_BC_MISDIRECTED: typing.ClassVar[FFModel.SetupStatus]
|
|
561
|
+
HYP_CLOSURE_MISSING: typing.ClassVar[FFModel.SetupStatus]
|
|
562
|
+
HYP_INCOMING_BC: typing.ClassVar[FFModel.SetupStatus]
|
|
563
|
+
INCONSISTENT_MODEL: typing.ClassVar[FFModel.SetupStatus]
|
|
564
|
+
INTERFACE_PLAN_INVALID: typing.ClassVar[FFModel.SetupStatus]
|
|
565
|
+
LINEAR_CACHE_FAILED: typing.ClassVar[FFModel.SetupStatus]
|
|
566
|
+
MODEL_COPY_FAILED: typing.ClassVar[FFModel.SetupStatus]
|
|
567
|
+
NODE_SETUP_FAILED: typing.ClassVar[FFModel.SetupStatus]
|
|
568
|
+
OK: typing.ClassVar[FFModel.SetupStatus]
|
|
569
|
+
REDUCED_DOF_INCONSISTENT: typing.ClassVar[FFModel.SetupStatus]
|
|
570
|
+
__members__: typing.ClassVar[dict[str, FFModel.SetupStatus]]
|
|
571
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
572
|
+
...
|
|
573
|
+
def __getstate__(self) -> int:
|
|
574
|
+
...
|
|
575
|
+
def __hash__(self) -> int:
|
|
576
|
+
...
|
|
577
|
+
def __index__(self) -> int:
|
|
578
|
+
...
|
|
579
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
580
|
+
...
|
|
581
|
+
def __int__(self) -> int:
|
|
582
|
+
...
|
|
583
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
584
|
+
...
|
|
585
|
+
def __repr__(self) -> str:
|
|
586
|
+
...
|
|
587
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
588
|
+
...
|
|
589
|
+
def __str__(self) -> str:
|
|
590
|
+
...
|
|
591
|
+
@property
|
|
592
|
+
def name(self) -> str:
|
|
593
|
+
...
|
|
594
|
+
@property
|
|
595
|
+
def value(self) -> int:
|
|
596
|
+
...
|
|
597
|
+
class EqnOptions:
|
|
598
|
+
"""
|
|
599
|
+
Options of one equation: its role and classification block.
|
|
600
|
+
"""
|
|
601
|
+
def __init__(self, role: FFModel.EqnRole = ..., block_id: typing.SupportsInt | typing.SupportsIndex = 0) -> None:
|
|
602
|
+
"""
|
|
603
|
+
Options with role-derived defaults (INITIAL, BOUNDARY, INTERFACE and DIAGNOSTIC rows do not enter classification).
|
|
604
|
+
"""
|
|
605
|
+
@property
|
|
606
|
+
def block_id(self) -> int:
|
|
607
|
+
"""
|
|
608
|
+
classification block
|
|
609
|
+
"""
|
|
610
|
+
@block_id.setter
|
|
611
|
+
def block_id(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
612
|
+
...
|
|
613
|
+
@property
|
|
614
|
+
def participate_in_classification(self) -> bool:
|
|
615
|
+
"""
|
|
616
|
+
enters block principal-symbol classification
|
|
617
|
+
"""
|
|
618
|
+
@participate_in_classification.setter
|
|
619
|
+
def participate_in_classification(self, arg0: bool) -> None:
|
|
620
|
+
...
|
|
621
|
+
@property
|
|
622
|
+
def role(self) -> FFModel.EqnRole:
|
|
623
|
+
"""
|
|
624
|
+
equation role (AUTO resolved on add)
|
|
625
|
+
"""
|
|
626
|
+
@role.setter
|
|
627
|
+
def role(self, arg0: FFModel.EqnRole) -> None:
|
|
628
|
+
...
|
|
629
|
+
@property
|
|
630
|
+
def role_auto(self) -> bool:
|
|
631
|
+
"""
|
|
632
|
+
True if the role was resolved from AUTO (re-resolved once the evolution domain is known).
|
|
633
|
+
"""
|
|
634
|
+
class Options:
|
|
635
|
+
"""
|
|
636
|
+
Model options: display, order reduction, classification, tolerances.
|
|
637
|
+
"""
|
|
638
|
+
class ReductionType:
|
|
639
|
+
"""
|
|
640
|
+
Order reduction at setup -- the values of REDUCE.ORDER: whether derivatives above first order are replaced by auxiliary states, and whether rows processed before an auxiliary existed are rewritten to use it.
|
|
641
|
+
|
|
642
|
+
Members:
|
|
643
|
+
|
|
644
|
+
RED_NONE : Do not perform order reduction during setup
|
|
645
|
+
|
|
646
|
+
RED_MAIN : Reduce high-order derivatives, leaving earlier rows their explicit derivative
|
|
647
|
+
|
|
648
|
+
RED_FULL : Reduce high-order derivatives and rewrite earlier rows to use the auxiliaries
|
|
649
|
+
"""
|
|
650
|
+
RED_FULL: typing.ClassVar[FFModel.Options.ReductionType]
|
|
651
|
+
RED_MAIN: typing.ClassVar[FFModel.Options.ReductionType]
|
|
652
|
+
RED_NONE: typing.ClassVar[FFModel.Options.ReductionType]
|
|
653
|
+
__members__: typing.ClassVar[dict[str, FFModel.Options.ReductionType]]
|
|
654
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
655
|
+
...
|
|
656
|
+
def __getstate__(self) -> int:
|
|
657
|
+
...
|
|
658
|
+
def __hash__(self) -> int:
|
|
659
|
+
...
|
|
660
|
+
def __index__(self) -> int:
|
|
661
|
+
...
|
|
662
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
663
|
+
...
|
|
664
|
+
def __int__(self) -> int:
|
|
665
|
+
...
|
|
666
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
667
|
+
...
|
|
668
|
+
def __repr__(self) -> str:
|
|
669
|
+
...
|
|
670
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
671
|
+
...
|
|
672
|
+
def __str__(self) -> str:
|
|
673
|
+
...
|
|
674
|
+
@property
|
|
675
|
+
def name(self) -> str:
|
|
676
|
+
...
|
|
677
|
+
@property
|
|
678
|
+
def value(self) -> int:
|
|
679
|
+
...
|
|
680
|
+
class RobustnessMode:
|
|
681
|
+
"""
|
|
682
|
+
How setup() tests the classification's sensitivity to the reference point -- the values of CLASSIFY.ROBUST: by sampling the reference and comparing the verdicts, or not at all.
|
|
683
|
+
|
|
684
|
+
Members:
|
|
685
|
+
|
|
686
|
+
ROBUST_OFF : Do not sample: classify at the reference point only (default)
|
|
687
|
+
|
|
688
|
+
ROBUST_REPORT : Sample and report disagreement; the verdict still comes from the base point
|
|
689
|
+
|
|
690
|
+
ROBUST_STRICT : Sample and treat disagreement as the classification being reference-sensitive
|
|
691
|
+
"""
|
|
692
|
+
ROBUST_OFF: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
693
|
+
ROBUST_REPORT: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
694
|
+
ROBUST_STRICT: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
695
|
+
__members__: typing.ClassVar[dict[str, FFModel.Options.RobustnessMode]]
|
|
696
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
697
|
+
...
|
|
698
|
+
def __getstate__(self) -> int:
|
|
699
|
+
...
|
|
700
|
+
def __hash__(self) -> int:
|
|
701
|
+
...
|
|
702
|
+
def __index__(self) -> int:
|
|
703
|
+
...
|
|
704
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
705
|
+
...
|
|
706
|
+
def __int__(self) -> int:
|
|
707
|
+
...
|
|
708
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
709
|
+
...
|
|
710
|
+
def __repr__(self) -> str:
|
|
711
|
+
...
|
|
712
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
713
|
+
...
|
|
714
|
+
def __str__(self) -> str:
|
|
715
|
+
...
|
|
716
|
+
@property
|
|
717
|
+
def name(self) -> str:
|
|
718
|
+
...
|
|
719
|
+
@property
|
|
720
|
+
def value(self) -> int:
|
|
721
|
+
...
|
|
722
|
+
class ClassifyType:
|
|
723
|
+
"""
|
|
724
|
+
How setup() classifies the PDE blocks -- the values of CLASSIFY.MODE.
|
|
725
|
+
|
|
726
|
+
Members:
|
|
727
|
+
|
|
728
|
+
CLASS_NONE : Do not perform PDE classification during setup
|
|
729
|
+
|
|
730
|
+
CLASS_AUTO : Attempt PDE classification during setup and proceed even if it fails
|
|
731
|
+
|
|
732
|
+
CLASS_STRICT : Attempt PDE classification during setup and interrupt when it fails
|
|
733
|
+
"""
|
|
734
|
+
CLASS_AUTO: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
735
|
+
CLASS_NONE: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
736
|
+
CLASS_STRICT: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
737
|
+
__members__: typing.ClassVar[dict[str, FFModel.Options.ClassifyType]]
|
|
738
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
739
|
+
...
|
|
740
|
+
def __getstate__(self) -> int:
|
|
741
|
+
...
|
|
742
|
+
def __hash__(self) -> int:
|
|
743
|
+
...
|
|
744
|
+
def __index__(self) -> int:
|
|
745
|
+
...
|
|
746
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
747
|
+
...
|
|
748
|
+
def __int__(self) -> int:
|
|
749
|
+
...
|
|
750
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
751
|
+
...
|
|
752
|
+
def __repr__(self) -> str:
|
|
753
|
+
...
|
|
754
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
755
|
+
...
|
|
756
|
+
def __str__(self) -> str:
|
|
757
|
+
...
|
|
758
|
+
@property
|
|
759
|
+
def name(self) -> str:
|
|
760
|
+
...
|
|
761
|
+
@property
|
|
762
|
+
def value(self) -> int:
|
|
763
|
+
...
|
|
764
|
+
class t_Reduce:
|
|
765
|
+
"""
|
|
766
|
+
Order reduction of high-order derivatives.
|
|
767
|
+
"""
|
|
768
|
+
def __init__(self) -> None:
|
|
769
|
+
...
|
|
770
|
+
@property
|
|
771
|
+
def HIDDEN_IC(self) -> bool:
|
|
772
|
+
"""
|
|
773
|
+
Materialise the HIDDEN constraints of a high-index reduction as INITIAL rows at the evolution boundary, so the model declares only the FREE initial data (default true since 2026-10-04; false was the former convention of one declared initial condition per differential state, made consistent by hand). A reduction that differentiates a constraint k times implies k lower levels which hold at the initial point but are not rows: with this off, the model must declare one initial condition per evolution-differential state and make the redundant ones consistent by hand (initial_data() says how many they are); with it on, those levels ARE rows, the free data alone makes the system square, and a full declaration is reported as a surplus by the DOF audit. Which data is free is a modelling choice -- for the index-3 pendulum {x,u} works, {x,y} does not.
|
|
774
|
+
"""
|
|
775
|
+
@HIDDEN_IC.setter
|
|
776
|
+
def HIDDEN_IC(self, arg0: bool) -> None:
|
|
777
|
+
...
|
|
778
|
+
@property
|
|
779
|
+
def NONLINEAR_PARTIALS(self) -> bool:
|
|
780
|
+
"""
|
|
781
|
+
Materialise first-order state-partials that appear NON-AFFINELY in a residual. reduce_order already peels high-order partials, and already materialises the partials carried INSIDE an OpI/OpEval operand (materialize_operand_partials), because a nonlocal reduction LINK cannot expose an inner OpP. It does NOT touch a first-order OpP(state,dir) sitting in an ordinary residual, which is right when the residual is AFFINE in it -- the principal-symbol proxy and the collocation Jacobian both handle a variable-coefficient derivative. It is NOT right when the derivative is wrapped nonlinearly: a DIVISION by a derivative (the ALE/moving-mesh 1/x_xi, u_xi/x_xi, u_xi/x_xi^2) or a transcendental of one (an arclength monitor sqrt(1+u_xi^2)). Those force a driver to hand-roll the derivative as a state with its own defining equation -- and hand-rolled auxiliaries are invisible to the classifier AS auxiliaries, which is how the multiply-defined flux states and the rectangular symbols in the moving-mesh drivers arose. When true, such a partial is minted as a derivative auxiliary Dp with a defining LINK OpP(state,dir) - Dp = 0 and substituted everywhere -- exactly the mint/LINK/reuse protocol the OpI/OpEval operand path already uses. The residual then contains only the STATE Dp inside the nonlinearity, and the raw OpP survives solely in a LINK, which is an ordinary differential equation the proxy pass resolves. The trigger is per-partial and minimal: a partial is materialised iff the residual is not AFFINE in THAT partial alone (mc::FFDep type != L). So `D*u_z`, `u*u_z`, `exp(-u)*u_z` are untouched, and in `(c-x_t)*u_xi/x_xi` ONLY x_xi is materialised -- x_t and u_xi remain ordinary variable-coefficient partials. Every residual that is affine in each of its first-order partials -- the entire existing corpus -- is therefore bit-identical. Default false: opt in, sweep, then consider promoting. Requires REDUCE.ORDER != RED_NONE.
|
|
782
|
+
"""
|
|
783
|
+
@NONLINEAR_PARTIALS.setter
|
|
784
|
+
def NONLINEAR_PARTIALS(self, arg0: bool) -> None:
|
|
785
|
+
...
|
|
786
|
+
@property
|
|
787
|
+
def ORDER(self) -> FFModel.Options.ReductionType:
|
|
788
|
+
"""
|
|
789
|
+
Order-reduction mode applied automatically by setup. RED_NONE leaves user equations unchanged. RED_MAIN performs first-order reduction without substituting matching first-order derivative nodes in pre-existing equations. RED_FULL also reuses the new auxiliary states in matching pre-existing equations; this is the default.
|
|
790
|
+
"""
|
|
791
|
+
@ORDER.setter
|
|
792
|
+
def ORDER(self, arg0: FFModel.Options.ReductionType) -> None:
|
|
793
|
+
...
|
|
794
|
+
class t_Classify:
|
|
795
|
+
"""
|
|
796
|
+
Classification of each block's principal symbol.
|
|
797
|
+
"""
|
|
798
|
+
def __init__(self) -> None:
|
|
799
|
+
...
|
|
800
|
+
@property
|
|
801
|
+
def IMAG_TOL(self) -> float:
|
|
802
|
+
"""
|
|
803
|
+
Imaginary-part/rank tolerance used by automatic classification.
|
|
804
|
+
"""
|
|
805
|
+
@IMAG_TOL.setter
|
|
806
|
+
def IMAG_TOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
807
|
+
...
|
|
808
|
+
@property
|
|
809
|
+
def MODE(self) -> FFModel.Options.ClassifyType:
|
|
810
|
+
"""
|
|
811
|
+
PDE classification during setup(): CLASS_AUTO (default), CLASS_NONE or CLASS_STRICT
|
|
812
|
+
"""
|
|
813
|
+
@MODE.setter
|
|
814
|
+
def MODE(self, arg0: FFModel.Options.ClassifyType) -> None:
|
|
815
|
+
...
|
|
816
|
+
@property
|
|
817
|
+
def NSAMPLE(self) -> int:
|
|
818
|
+
"""
|
|
819
|
+
Number of angular samples for no-evolution-domain classification.
|
|
820
|
+
"""
|
|
821
|
+
@NSAMPLE.setter
|
|
822
|
+
def NSAMPLE(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
823
|
+
...
|
|
824
|
+
@property
|
|
825
|
+
def ROBUST(self) -> FFModel.Options.RobustnessMode:
|
|
826
|
+
"""
|
|
827
|
+
Reference-robustness sampling (see RobustnessMode). (0 = off, 1 = report, 2 = strict).
|
|
828
|
+
"""
|
|
829
|
+
@ROBUST.setter
|
|
830
|
+
def ROBUST(self, arg0: FFModel.Options.RobustnessMode) -> None:
|
|
831
|
+
...
|
|
832
|
+
class t_Auto:
|
|
833
|
+
"""
|
|
834
|
+
Automatic model transformations applied at setup(): boundary closures and differential elimination.
|
|
835
|
+
"""
|
|
836
|
+
def __init__(self) -> None:
|
|
837
|
+
...
|
|
838
|
+
@property
|
|
839
|
+
def DIFF_ELIM(self) -> bool:
|
|
840
|
+
"""
|
|
841
|
+
auto differential-elimination of algebraically-determined derivatives (substitute + relocate consumer onto source face); OFF by default
|
|
842
|
+
"""
|
|
843
|
+
@DIFF_ELIM.setter
|
|
844
|
+
def DIFF_ELIM(self, arg0: bool) -> None:
|
|
845
|
+
...
|
|
846
|
+
@property
|
|
847
|
+
def HYP_CLOSURE(self) -> bool:
|
|
848
|
+
"""
|
|
849
|
+
auto closure of the OUTFLOW faces of hyperbolic blocks: appends the missing outgoing-characteristic rows (default on). Off: the model must close every outflow face itself (e.g. its PDE extended to the face) -- setup REFUSES (HYP_CLOSURE_MISSING) when rows are missing, as an under-determined system would be solved silently wrong
|
|
850
|
+
"""
|
|
851
|
+
@HYP_CLOSURE.setter
|
|
852
|
+
def HYP_CLOSURE(self, arg0: bool) -> None:
|
|
853
|
+
...
|
|
854
|
+
CLASS_AUTO: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
855
|
+
CLASS_NONE: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
856
|
+
CLASS_STRICT: typing.ClassVar[FFModel.Options.ClassifyType]
|
|
857
|
+
RED_FULL: typing.ClassVar[FFModel.Options.ReductionType]
|
|
858
|
+
RED_MAIN: typing.ClassVar[FFModel.Options.ReductionType]
|
|
859
|
+
RED_NONE: typing.ClassVar[FFModel.Options.ReductionType]
|
|
860
|
+
ROBUST_OFF: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
861
|
+
ROBUST_REPORT: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
862
|
+
ROBUST_STRICT: typing.ClassVar[FFModel.Options.RobustnessMode]
|
|
863
|
+
@typing.overload
|
|
864
|
+
def __init__(self) -> None:
|
|
865
|
+
...
|
|
866
|
+
@typing.overload
|
|
867
|
+
def __init__(self, arg0: FFModel.Options) -> None:
|
|
868
|
+
...
|
|
869
|
+
@property
|
|
870
|
+
def AUTO(self) -> FFModel.Options.t_Auto:
|
|
871
|
+
"""
|
|
872
|
+
Automatic model transformations applied at setup(): boundary closures and differential elimination.
|
|
873
|
+
"""
|
|
874
|
+
@AUTO.setter
|
|
875
|
+
def AUTO(self, arg0: FFModel.Options.t_Auto) -> None:
|
|
876
|
+
...
|
|
877
|
+
@property
|
|
878
|
+
def CLASSIFY(self) -> FFModel.Options.t_Classify:
|
|
879
|
+
"""
|
|
880
|
+
Classification of each block's principal symbol.
|
|
881
|
+
"""
|
|
882
|
+
@CLASSIFY.setter
|
|
883
|
+
def CLASSIFY(self, arg0: FFModel.Options.t_Classify) -> None:
|
|
884
|
+
...
|
|
885
|
+
@property
|
|
886
|
+
def DISPLAY_LEVEL(self) -> int:
|
|
887
|
+
"""
|
|
888
|
+
Console verbosity for setup()/eval() (default: 0). Tiered: 0 = silent: only errors, validation failures, and warnings print. 1 = key structural decisions: closures, interface-plan DROP / KEEP- EXPLICIT, continuity redundancy / value-slaved drops, order and tau reduction summaries. 2 = detailed diagnostics (includes everything at level 1): phase and [iplan] timings, trace conditioning (rcond / SVD / sparsity), per-predicate timing accumulators, verbose detection and edge breakdowns. Errors and warnings are NEVER gated by this level.
|
|
889
|
+
"""
|
|
890
|
+
@DISPLAY_LEVEL.setter
|
|
891
|
+
def DISPLAY_LEVEL(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
892
|
+
...
|
|
893
|
+
@property
|
|
894
|
+
def MAXTHREAD(self) -> int:
|
|
895
|
+
"""
|
|
896
|
+
cap on the threads the numerical backends may use inside setup() and solve(). SPQR, SuperLU, UMFPACK, KLU and every dense LAPACK call take their parallelism from the SAME BLAS/OpenMP layer, so ONE cap covers them all -- SPQR has no thread pool of its own (its TBB path was removed upstream, and cc.SPQR_nthreads is now inert). 1 (default since 2026-10-09; was 0): one thread. 0 imposes NO cap: the runtime is left exactly as the environment set it -- usually ALL cores, OpenBLAS's and OpenMP's own default. n>0 caps to n for the duration of the call and RESTORES the previous setting on every exit. NOTE the deliberate difference from FFGraph::Options:: MAXTHREAD, which reads 0 as "hardware_concurrency": here 0 means "do not touch", so an outer OMP_NUM_THREADS or a cluster allocation is respected rather than overridden. MEASURED (PDE5, 9 audit windows): cap=1 is 18% FASTER than the uncapped run -- 152.4 s against 186.0 s of rank time. MEASURED (PDE38, 16 cores): uncapped, the SPQR build ran 29.6 s on 431 s of CPU; capped at 1, 16.4 s on 15 s (and without SPQR 19.7 s -> 18.7 s): CRONOS's frontal and dense blocks are too small for threads to pay. Results identical. Environment: CRONOS_MAXTHREAD.
|
|
897
|
+
"""
|
|
898
|
+
@MAXTHREAD.setter
|
|
899
|
+
def MAXTHREAD(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
900
|
+
...
|
|
901
|
+
@property
|
|
902
|
+
def REDUCE(self) -> FFModel.Options.t_Reduce:
|
|
903
|
+
"""
|
|
904
|
+
Order reduction of high-order derivatives.
|
|
905
|
+
"""
|
|
906
|
+
@REDUCE.setter
|
|
907
|
+
def REDUCE(self, arg0: FFModel.Options.t_Reduce) -> None:
|
|
908
|
+
...
|
|
909
|
+
@property
|
|
910
|
+
def TTOL(self) -> float:
|
|
911
|
+
"""
|
|
912
|
+
Two time points closer than this are the SAME point (1e-9). A consumer that stages a model -- an integrator, a marching solve, anything that stops at boundaries -- must decide whether a function's time point coincides with an element boundary, and an exact comparison is the wrong test for a value that was typed or computed. Absolute, in the units of the evolution domain.
|
|
913
|
+
"""
|
|
914
|
+
@TTOL.setter
|
|
915
|
+
def TTOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
916
|
+
...
|
|
917
|
+
class FctKind:
|
|
918
|
+
"""
|
|
919
|
+
Kind of an output.
|
|
920
|
+
|
|
921
|
+
Members:
|
|
922
|
+
|
|
923
|
+
POINT : a scalar output, or a value at a point of its domains
|
|
924
|
+
|
|
925
|
+
DISTRIBUTED : an output distributed over a region of its domains
|
|
926
|
+
"""
|
|
927
|
+
DISTRIBUTED: typing.ClassVar[FFModel.FctKind]
|
|
928
|
+
POINT: typing.ClassVar[FFModel.FctKind]
|
|
929
|
+
__members__: typing.ClassVar[dict[str, FFModel.FctKind]]
|
|
930
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
931
|
+
...
|
|
932
|
+
def __getstate__(self) -> int:
|
|
933
|
+
...
|
|
934
|
+
def __hash__(self) -> int:
|
|
935
|
+
...
|
|
936
|
+
def __index__(self) -> int:
|
|
937
|
+
...
|
|
938
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
939
|
+
...
|
|
940
|
+
def __int__(self) -> int:
|
|
941
|
+
...
|
|
942
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
943
|
+
...
|
|
944
|
+
def __repr__(self) -> str:
|
|
945
|
+
...
|
|
946
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
947
|
+
...
|
|
948
|
+
def __str__(self) -> str:
|
|
949
|
+
...
|
|
950
|
+
@property
|
|
951
|
+
def name(self) -> str:
|
|
952
|
+
...
|
|
953
|
+
@property
|
|
954
|
+
def value(self) -> int:
|
|
955
|
+
...
|
|
956
|
+
class t_Eqn:
|
|
957
|
+
"""
|
|
958
|
+
A declared equation: its residual, its region (mask per domain), and its
|
|
959
|
+
options.
|
|
960
|
+
"""
|
|
961
|
+
def __repr__(self) -> str:
|
|
962
|
+
...
|
|
963
|
+
def __str__(self) -> str:
|
|
964
|
+
"""
|
|
965
|
+
The equation written out: ``0 = <expression> on <region>``.
|
|
966
|
+
"""
|
|
967
|
+
@property
|
|
968
|
+
def dom(self) -> dict[pymcpp.FFVar, int]:
|
|
969
|
+
"""
|
|
970
|
+
Domain mask per domain variable, ``{domain: mask}``.
|
|
971
|
+
"""
|
|
972
|
+
@property
|
|
973
|
+
def opt(self) -> FFModel.EqnOptions:
|
|
974
|
+
"""
|
|
975
|
+
Normalised equation options (a copy).
|
|
976
|
+
"""
|
|
977
|
+
@property
|
|
978
|
+
def var(self) -> pymcpp.FFVar:
|
|
979
|
+
"""
|
|
980
|
+
Residual expression (equation: var = 0).
|
|
981
|
+
"""
|
|
982
|
+
class t_Fct:
|
|
983
|
+
"""
|
|
984
|
+
A declared output: its expression, kind, fixed coordinates and sides, and the
|
|
985
|
+
masks of its distributed dimensions.
|
|
986
|
+
"""
|
|
987
|
+
def __repr__(self) -> str:
|
|
988
|
+
...
|
|
989
|
+
def __str__(self) -> str:
|
|
990
|
+
"""
|
|
991
|
+
The output written out, with its point or its region.
|
|
992
|
+
"""
|
|
993
|
+
@property
|
|
994
|
+
def grid(self) -> dict[pymcpp.FFVar, int]:
|
|
995
|
+
"""
|
|
996
|
+
Masks of the distributed dimensions, ``{domain: mask}``.
|
|
997
|
+
"""
|
|
998
|
+
@property
|
|
999
|
+
def kind(self) -> FFModel.FctKind:
|
|
1000
|
+
"""
|
|
1001
|
+
Point or distributed output.
|
|
1002
|
+
"""
|
|
1003
|
+
@property
|
|
1004
|
+
def nrow(self) -> int:
|
|
1005
|
+
"""
|
|
1006
|
+
Number of output rows (set by the solver).
|
|
1007
|
+
"""
|
|
1008
|
+
@property
|
|
1009
|
+
def point(self) -> dict[pymcpp.FFVar, float]:
|
|
1010
|
+
"""
|
|
1011
|
+
Fixed coordinates, ``{domain: coordinate}``.
|
|
1012
|
+
"""
|
|
1013
|
+
@property
|
|
1014
|
+
def row0(self) -> int:
|
|
1015
|
+
"""
|
|
1016
|
+
First row in the output array (set by the solver).
|
|
1017
|
+
"""
|
|
1018
|
+
@property
|
|
1019
|
+
def side(self) -> dict[pymcpp.FFVar, int]:
|
|
1020
|
+
"""
|
|
1021
|
+
Sides given as PLUS, ``{domain: 1}`` (absent: MINUS).
|
|
1022
|
+
"""
|
|
1023
|
+
@property
|
|
1024
|
+
def var(self) -> pymcpp.FFVar:
|
|
1025
|
+
"""
|
|
1026
|
+
Output expression.
|
|
1027
|
+
"""
|
|
1028
|
+
CONTINUOUS_C0: typing.ClassVar[FFModel.InputContinuity]
|
|
1029
|
+
DISCONTINUOUS: typing.ClassVar[FFModel.InputContinuity]
|
|
1030
|
+
DISTRIBUTED: typing.ClassVar[FFModel.FctKind]
|
|
1031
|
+
POINT: typing.ClassVar[FFModel.FctKind]
|
|
1032
|
+
SMOOTH_C1: typing.ClassVar[FFModel.InputContinuity]
|
|
1033
|
+
@staticmethod
|
|
1034
|
+
def revision() -> str:
|
|
1035
|
+
"""
|
|
1036
|
+
The revision of the model layer (ffmodel.hpp), e.g. for a bug report. The model report
|
|
1037
|
+
does not print it.
|
|
1038
|
+
"""
|
|
1039
|
+
def __init__(self, dag: pymcpp.FFGraph) -> None:
|
|
1040
|
+
"""
|
|
1041
|
+
Empty model declared on the DAG ``dag`` (kept alive by the model).
|
|
1042
|
+
"""
|
|
1043
|
+
def __str__(self) -> str:
|
|
1044
|
+
"""
|
|
1045
|
+
Report of the model.
|
|
1046
|
+
"""
|
|
1047
|
+
@typing.overload
|
|
1048
|
+
def add_domain(self, var: pymcpp.FFVar, dom: FFDom, ref: typing.SupportsFloat | typing.SupportsIndex | None = None) -> None:
|
|
1049
|
+
"""
|
|
1050
|
+
Declare the domain of an independent variable.
|
|
1051
|
+
|
|
1052
|
+
Parameters
|
|
1053
|
+
----------
|
|
1054
|
+
var : FFVar
|
|
1055
|
+
The independent variable.
|
|
1056
|
+
dom : FFDom
|
|
1057
|
+
Its bounds, finite elements and collocation nodes.
|
|
1058
|
+
ref : float, optional
|
|
1059
|
+
Reference coordinate for the model analyses.
|
|
1060
|
+
"""
|
|
1061
|
+
@typing.overload
|
|
1062
|
+
def add_domain(self, vars: collections.abc.Sequence[pymcpp.FFVar], dom: FFDom, ref: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> None:
|
|
1063
|
+
"""
|
|
1064
|
+
Declare several independent variables on the same domain.
|
|
1065
|
+
"""
|
|
1066
|
+
@typing.overload
|
|
1067
|
+
def add_equation(self, eqn: pymcpp.FFVar, doms: collections.abc.Sequence[pymcpp.FFVar] = [], masks: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex] = [], options: FFModel.EqnOptions = ...) -> None:
|
|
1068
|
+
"""
|
|
1069
|
+
Declare the equation ``eqn = 0`` on a region of its domains.
|
|
1070
|
+
|
|
1071
|
+
Parameters
|
|
1072
|
+
----------
|
|
1073
|
+
eqn : FFVar
|
|
1074
|
+
The residual.
|
|
1075
|
+
doms : list of FFVar
|
|
1076
|
+
Its domains (empty for a scalar equation).
|
|
1077
|
+
masks : list of int
|
|
1078
|
+
The region per domain: ``FFDom.ALL``, ``LB``, ``UB``, or combinations such
|
|
1079
|
+
as ``FFDom.ALL - FFDom.LB``.
|
|
1080
|
+
options : FFModel.EqnOptions, optional
|
|
1081
|
+
Role and classification block (default: role resolved from the masks).
|
|
1082
|
+
"""
|
|
1083
|
+
@typing.overload
|
|
1084
|
+
def add_equation(self, eqns: collections.abc.Sequence[pymcpp.FFVar], doms: collections.abc.Sequence[pymcpp.FFVar] = [], masks: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex] = [], options: FFModel.EqnOptions = ...) -> None:
|
|
1085
|
+
"""
|
|
1086
|
+
Declare several equations on the same region.
|
|
1087
|
+
"""
|
|
1088
|
+
@typing.overload
|
|
1089
|
+
def add_input(self, var: pymcpp.FFVar, doms: collections.abc.Sequence[pymcpp.FFVar] = [], *, ref: typing.SupportsFloat | typing.SupportsIndex | collections.abc.Callable[[collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex]], float] | None = None, type: FFDom.TYPE | None = None, n_node: typing.SupportsInt | typing.SupportsIndex = 0, continuity: collections.abc.Sequence[FFModel.InputContinuity] | None = None, is_decision: bool = False) -> None:
|
|
1090
|
+
"""
|
|
1091
|
+
Declare an input: a parameter (no domains) or a distributed input over
|
|
1092
|
+
``doms``.
|
|
1093
|
+
|
|
1094
|
+
Parameters
|
|
1095
|
+
----------
|
|
1096
|
+
var : FFVar
|
|
1097
|
+
The input.
|
|
1098
|
+
doms : list of FFVar, optional
|
|
1099
|
+
Its independent variables (empty: a scalar parameter).
|
|
1100
|
+
ref : float or callable, optional
|
|
1101
|
+
Reference value, or a function ``ref({dom: coordinate}) -> float``.
|
|
1102
|
+
type : FFDom.TYPE, optional
|
|
1103
|
+
The input's own collocation node family (with ``n_node``); default: that
|
|
1104
|
+
of its domains.
|
|
1105
|
+
n_node : int, optional
|
|
1106
|
+
Number of nodes per element for ``type``.
|
|
1107
|
+
continuity : list of FFModel.InputContinuity, optional
|
|
1108
|
+
Continuity per domain across element interfaces (with a float ``ref``
|
|
1109
|
+
only).
|
|
1110
|
+
is_decision : bool, optional
|
|
1111
|
+
Register the input as a control (decision) at setup.
|
|
1112
|
+
"""
|
|
1113
|
+
@typing.overload
|
|
1114
|
+
def add_input(self, vars: collections.abc.Sequence[pymcpp.FFVar], doms: collections.abc.Sequence[pymcpp.FFVar] = [], ref: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> None:
|
|
1115
|
+
"""
|
|
1116
|
+
Declare several inputs over the same domains.
|
|
1117
|
+
"""
|
|
1118
|
+
def add_output(self, fct: pymcpp.FFVar, doms: collections.abc.Sequence[pymcpp.FFVar] = [], *, point: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | None = None, side: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex] | None = None, masks: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex] | None = None, at: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex] | None = None) -> int:
|
|
1119
|
+
"""
|
|
1120
|
+
Declare an output.
|
|
1121
|
+
|
|
1122
|
+
- ``add_output(f)``: a scalar output (values and integrals built with
|
|
1123
|
+
``FFEval`` / ``FFIntegral``);
|
|
1124
|
+
- ``add_output(f, doms, point=[...], side=[...])``: ``f`` at a point of
|
|
1125
|
+
``doms``, from the given sides;
|
|
1126
|
+
- ``add_output(f, doms, masks=[...])``: ``f`` distributed over a region of
|
|
1127
|
+
``doms``;
|
|
1128
|
+
- ``add_output(f, doms, masks=[...], at={z: z0})``: distributed over ``doms``
|
|
1129
|
+
at fixed coordinates of others.
|
|
1130
|
+
|
|
1131
|
+
Parameters
|
|
1132
|
+
----------
|
|
1133
|
+
fct : FFVar
|
|
1134
|
+
The output expression.
|
|
1135
|
+
doms : list of FFVar, optional
|
|
1136
|
+
Domains of the point or of the distribution.
|
|
1137
|
+
point : list of float, optional
|
|
1138
|
+
Coordinates, one per domain (point output).
|
|
1139
|
+
side : list of int, optional
|
|
1140
|
+
Side per domain for a point output: ``FFDom.MINUS`` (default) or
|
|
1141
|
+
``FFDom.PLUS``.
|
|
1142
|
+
masks : list of int, optional
|
|
1143
|
+
Region per domain (distributed output).
|
|
1144
|
+
at : dict of FFVar to float, optional
|
|
1145
|
+
Fixed coordinates of further domains (distributed output).
|
|
1146
|
+
|
|
1147
|
+
Returns
|
|
1148
|
+
-------
|
|
1149
|
+
int
|
|
1150
|
+
The INDEX of the new output: outputs are numbered in declaration order,
|
|
1151
|
+
from 0, and the index is the output's position in ``blk_fct()`` of a
|
|
1152
|
+
solver (``OCFESLV``, ``ODESLV``) once the model is set up.
|
|
1153
|
+
"""
|
|
1154
|
+
@typing.overload
|
|
1155
|
+
def add_state(self, var: pymcpp.FFVar, doms: collections.abc.Sequence[pymcpp.FFVar], ref: typing.SupportsFloat | typing.SupportsIndex | None = None) -> None:
|
|
1156
|
+
"""
|
|
1157
|
+
Declare a state over the domains ``doms`` (empty for a scalar state).
|
|
1158
|
+
|
|
1159
|
+
Parameters
|
|
1160
|
+
----------
|
|
1161
|
+
var : FFVar
|
|
1162
|
+
The state.
|
|
1163
|
+
doms : list of FFVar
|
|
1164
|
+
Its independent variables.
|
|
1165
|
+
ref : float, optional
|
|
1166
|
+
Reference value (initial guess and analyses).
|
|
1167
|
+
"""
|
|
1168
|
+
@typing.overload
|
|
1169
|
+
def add_state(self, var: pymcpp.FFVar, doms: collections.abc.Sequence[pymcpp.FFVar], ref: collections.abc.Callable[[collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex]], float]) -> None:
|
|
1170
|
+
"""
|
|
1171
|
+
Declare a state with a reference function ``ref({dom: coordinate}) -> float``.
|
|
1172
|
+
"""
|
|
1173
|
+
@typing.overload
|
|
1174
|
+
def add_state(self, vars: collections.abc.Sequence[pymcpp.FFVar], doms: collections.abc.Sequence[pymcpp.FFVar], ref: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> None:
|
|
1175
|
+
"""
|
|
1176
|
+
Declare several states over the same domains.
|
|
1177
|
+
"""
|
|
1178
|
+
@typing.overload
|
|
1179
|
+
def add_transition(self, left: collections.abc.Sequence[pymcpp.FFVar], right: collections.abc.Sequence[pymcpp.FFVar], dom: pymcpp.FFVar, tau: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1180
|
+
"""
|
|
1181
|
+
Declare a transition at ``dom = tau``: the equations ``left(tau^-) =
|
|
1182
|
+
right(tau^+)``, which determine the post-jump values of the states they
|
|
1183
|
+
involve. States not mentioned are continuous.
|
|
1184
|
+
|
|
1185
|
+
Parameters
|
|
1186
|
+
----------
|
|
1187
|
+
left, right : list of FFVar
|
|
1188
|
+
Expressions evaluated before and after the jump.
|
|
1189
|
+
dom : FFVar
|
|
1190
|
+
The evolution domain.
|
|
1191
|
+
tau : float
|
|
1192
|
+
Location of the jump (interior to the domain).
|
|
1193
|
+
"""
|
|
1194
|
+
@typing.overload
|
|
1195
|
+
def add_transition(self, left: pymcpp.FFVar, right: pymcpp.FFVar, dom: pymcpp.FFVar, tau: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1196
|
+
"""
|
|
1197
|
+
Scalar form of ``add_transition``.
|
|
1198
|
+
"""
|
|
1199
|
+
@typing.overload
|
|
1200
|
+
def add_transition(self, left: collections.abc.Sequence[pymcpp.FFVar], right: collections.abc.Sequence[pymcpp.FFVar]) -> None:
|
|
1201
|
+
"""
|
|
1202
|
+
Transition given through one-sided evaluations: ``left`` evaluated at tau^- (``FFDom.MINUS``), ``right`` at tau^+ (``FFDom.PLUS``).
|
|
1203
|
+
"""
|
|
1204
|
+
@typing.overload
|
|
1205
|
+
def add_transition(self, left: pymcpp.FFVar, right: pymcpp.FFVar) -> None:
|
|
1206
|
+
"""
|
|
1207
|
+
Scalar form of the one-sided ``add_transition``.
|
|
1208
|
+
"""
|
|
1209
|
+
def clear_controls(self) -> None:
|
|
1210
|
+
"""
|
|
1211
|
+
Clear the control registry.
|
|
1212
|
+
"""
|
|
1213
|
+
def control_dofs(self, var: pymcpp.FFVar) -> list[FFModel.DofIndex]:
|
|
1214
|
+
"""
|
|
1215
|
+
The DOF indices of control ``var``, in the order of its values.
|
|
1216
|
+
"""
|
|
1217
|
+
def fix_input(self, var: pymcpp.FFVar, values: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex]) -> None:
|
|
1218
|
+
"""
|
|
1219
|
+
Hold a declared input at known values: substituted as constants, never a parameter or a control.
|
|
1220
|
+
"""
|
|
1221
|
+
def is_setup(self) -> bool:
|
|
1222
|
+
"""
|
|
1223
|
+
True once ``setup()`` has succeeded.
|
|
1224
|
+
"""
|
|
1225
|
+
def n_control_dof(self) -> int:
|
|
1226
|
+
"""
|
|
1227
|
+
Total number of control DOFs.
|
|
1228
|
+
"""
|
|
1229
|
+
def register_control(self, var: pymcpp.FFVar) -> None:
|
|
1230
|
+
"""
|
|
1231
|
+
Register a declared input as a control: its DOFs become the sensitivity directions, in registration order.
|
|
1232
|
+
"""
|
|
1233
|
+
def report(self) -> None:
|
|
1234
|
+
"""
|
|
1235
|
+
Print the model report (the same text as ``str(model)``).
|
|
1236
|
+
"""
|
|
1237
|
+
def set_constant(self, vars: collections.abc.Sequence[pymcpp.FFVar], values: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> None:
|
|
1238
|
+
"""
|
|
1239
|
+
Declare constants: parameters whose values are given at solve time rather than
|
|
1240
|
+
differentiated.
|
|
1241
|
+
|
|
1242
|
+
Parameters
|
|
1243
|
+
----------
|
|
1244
|
+
vars : list of FFVar
|
|
1245
|
+
The constants.
|
|
1246
|
+
values : list of float, optional
|
|
1247
|
+
Their values, one per constant.
|
|
1248
|
+
"""
|
|
1249
|
+
def set_evolution_domain(self, dom: pymcpp.FFVar) -> None:
|
|
1250
|
+
"""
|
|
1251
|
+
Declare which domain variable is the evolution direction (time); it must have been added with ``add_domain``.
|
|
1252
|
+
"""
|
|
1253
|
+
def setup(self) -> bool:
|
|
1254
|
+
"""
|
|
1255
|
+
Validate and analyse the model; returns False on failure (see
|
|
1256
|
+
``setup_status``).
|
|
1257
|
+
|
|
1258
|
+
The setup report (``options.DISPLAY_LEVEL`` >= 1) and any diagnostics, written
|
|
1259
|
+
by C++ to std::cout / std::cerr, are redirected to Python's ``sys.stdout`` /
|
|
1260
|
+
``sys.stderr`` for the duration of the call, so they appear in notebooks.
|
|
1261
|
+
"""
|
|
1262
|
+
@typing.overload
|
|
1263
|
+
def update_ref(self, var: pymcpp.FFVar, ref: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1264
|
+
"""
|
|
1265
|
+
Set the reference value of a state or input.
|
|
1266
|
+
"""
|
|
1267
|
+
@typing.overload
|
|
1268
|
+
def update_ref(self, var: pymcpp.FFVar, ref: collections.abc.Callable[[collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex]], float]) -> None:
|
|
1269
|
+
"""
|
|
1270
|
+
Set the reference function ``ref({dom: coordinate}) -> float`` of a state or input.
|
|
1271
|
+
"""
|
|
1272
|
+
@property
|
|
1273
|
+
def options(self) -> FFModel.Options:
|
|
1274
|
+
"""
|
|
1275
|
+
Model options (the solvers extend them).
|
|
1276
|
+
"""
|
|
1277
|
+
@options.setter
|
|
1278
|
+
def options(self, arg0: FFModel.Options) -> None:
|
|
1279
|
+
...
|
|
1280
|
+
@property
|
|
1281
|
+
def setup_status(self) -> FFModel.SetupStatus:
|
|
1282
|
+
"""
|
|
1283
|
+
Outcome of the last ``setup()``.
|
|
1284
|
+
"""
|
|
1285
|
+
@property
|
|
1286
|
+
def var_constant(self) -> list[pymcpp.FFVar]:
|
|
1287
|
+
"""
|
|
1288
|
+
Declared constants.
|
|
1289
|
+
"""
|
|
1290
|
+
@property
|
|
1291
|
+
def var_declared_input(self) -> dict[pymcpp.FFVar, set[pymcpp.FFVar]]:
|
|
1292
|
+
"""
|
|
1293
|
+
Inputs declared by the modeller.
|
|
1294
|
+
"""
|
|
1295
|
+
@property
|
|
1296
|
+
def var_domain(self) -> dict[pymcpp.FFVar, FFDom]:
|
|
1297
|
+
"""
|
|
1298
|
+
Declared domain variables.
|
|
1299
|
+
"""
|
|
1300
|
+
@property
|
|
1301
|
+
def var_equation(self) -> list[FFModel.t_Eqn]:
|
|
1302
|
+
"""
|
|
1303
|
+
Declared equations, as ``FFModel.t_Eqn`` records.
|
|
1304
|
+
"""
|
|
1305
|
+
@property
|
|
1306
|
+
def var_input(self) -> dict[pymcpp.FFVar, set[pymcpp.FFVar]]:
|
|
1307
|
+
"""
|
|
1308
|
+
Inputs of the model (declared ones and those created by setup).
|
|
1309
|
+
"""
|
|
1310
|
+
@property
|
|
1311
|
+
def var_output(self) -> list[FFModel.t_Fct]:
|
|
1312
|
+
"""
|
|
1313
|
+
Declared outputs, as ``FFModel.t_Fct`` records.
|
|
1314
|
+
"""
|
|
1315
|
+
@property
|
|
1316
|
+
def var_state(self) -> dict[pymcpp.FFVar, set[pymcpp.FFVar]]:
|
|
1317
|
+
"""
|
|
1318
|
+
Declared states.
|
|
1319
|
+
"""
|
|
1320
|
+
class ODESLV(FFModel):
|
|
1321
|
+
"""
|
|
1322
|
+
Solver of an FFModel by CVODES (SUNDIALS): integration of the model along its
|
|
1323
|
+
evolution direction, with forward (``solve_fsens``) and adjoint
|
|
1324
|
+
(``solve_asens``) sensitivity analysis of its outputs.
|
|
1325
|
+
|
|
1326
|
+
The model is declared through the FFModel methods (domains, states, inputs,
|
|
1327
|
+
equations, outputs, transitions); ``setup()`` analyses it and builds the
|
|
1328
|
+
integrator. Inputs are either passed positionally (the parameter vector of
|
|
1329
|
+
``var_parameter``) or by name (a dict).
|
|
1330
|
+
|
|
1331
|
+
Example -- x' = -p x, x(0) = 1, output x(1):
|
|
1332
|
+
|
|
1333
|
+
>>> from pymcpp import FFGraph, FFPartial, FFEval
|
|
1334
|
+
>>> from cronos import FFDom, ODESLV
|
|
1335
|
+
>>> G = FFGraph(); t, x, p = G.add_var("t"), G.add_var("x"), G.add_var("p")
|
|
1336
|
+
>>> OpP, OpE = FFPartial(), FFEval()
|
|
1337
|
+
>>> S = ODESLV(G)
|
|
1338
|
+
>>> S.add_domain(t, FFDom(0., 1., 2)); S.set_evolution_domain(t)
|
|
1339
|
+
>>> S.add_state(x, [t]); S.add_input(p)
|
|
1340
|
+
>>> S.add_equation(OpP(x, t) + p*x, [t], [FFDom.ALL - FFDom.LB])
|
|
1341
|
+
>>> S.add_equation(x - 1., [t], [FFDom.LB])
|
|
1342
|
+
>>> S.add_output(OpE(x, t, 1.))
|
|
1343
|
+
>>> S.setup()
|
|
1344
|
+
>>> S.solve({p: [0.7]}); S.val_function() # [exp(-0.7)]
|
|
1345
|
+
"""
|
|
1346
|
+
class STATUS:
|
|
1347
|
+
"""
|
|
1348
|
+
Status of an integration.
|
|
1349
|
+
|
|
1350
|
+
Members:
|
|
1351
|
+
|
|
1352
|
+
NORMAL : Normal execution
|
|
1353
|
+
|
|
1354
|
+
FAILURE : Integration breakdown
|
|
1355
|
+
|
|
1356
|
+
FATAL : Interruption due to errors in third-party libraries
|
|
1357
|
+
"""
|
|
1358
|
+
FAILURE: typing.ClassVar[ODESLV.STATUS]
|
|
1359
|
+
FATAL: typing.ClassVar[ODESLV.STATUS]
|
|
1360
|
+
NORMAL: typing.ClassVar[ODESLV.STATUS]
|
|
1361
|
+
__members__: typing.ClassVar[dict[str, ODESLV.STATUS]]
|
|
1362
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1363
|
+
...
|
|
1364
|
+
def __getstate__(self) -> int:
|
|
1365
|
+
...
|
|
1366
|
+
def __hash__(self) -> int:
|
|
1367
|
+
...
|
|
1368
|
+
def __index__(self) -> int:
|
|
1369
|
+
...
|
|
1370
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1371
|
+
...
|
|
1372
|
+
def __int__(self) -> int:
|
|
1373
|
+
...
|
|
1374
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1375
|
+
...
|
|
1376
|
+
def __repr__(self) -> str:
|
|
1377
|
+
...
|
|
1378
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1379
|
+
...
|
|
1380
|
+
def __str__(self) -> str:
|
|
1381
|
+
...
|
|
1382
|
+
@property
|
|
1383
|
+
def name(self) -> str:
|
|
1384
|
+
...
|
|
1385
|
+
@property
|
|
1386
|
+
def value(self) -> int:
|
|
1387
|
+
...
|
|
1388
|
+
class Options(FFModel.Options):
|
|
1389
|
+
"""
|
|
1390
|
+
Options of ODESLV: the model options (FFModel.Options) and the CVODES options
|
|
1391
|
+
(integration method, nonlinear and linear solvers, tolerances, sensitivity
|
|
1392
|
+
settings).
|
|
1393
|
+
"""
|
|
1394
|
+
class FSA_STRATEGY:
|
|
1395
|
+
"""
|
|
1396
|
+
Enumeration type for FSA method
|
|
1397
|
+
|
|
1398
|
+
Members:
|
|
1399
|
+
|
|
1400
|
+
SIMULTANEOUS : Simultaneous state/sensitivity correction
|
|
1401
|
+
|
|
1402
|
+
STAGGERED : Simultaneous sensitivity corrections after state corrections
|
|
1403
|
+
|
|
1404
|
+
STAGGERED1 : Sequential sensitivity corrections after state corrections
|
|
1405
|
+
"""
|
|
1406
|
+
SIMULTANEOUS: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1407
|
+
STAGGERED: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1408
|
+
STAGGERED1: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1409
|
+
__members__: typing.ClassVar[dict[str, ODESLV.Options.FSA_STRATEGY]]
|
|
1410
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1411
|
+
...
|
|
1412
|
+
def __getstate__(self) -> int:
|
|
1413
|
+
...
|
|
1414
|
+
def __hash__(self) -> int:
|
|
1415
|
+
...
|
|
1416
|
+
def __index__(self) -> int:
|
|
1417
|
+
...
|
|
1418
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1419
|
+
...
|
|
1420
|
+
def __int__(self) -> int:
|
|
1421
|
+
...
|
|
1422
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1423
|
+
...
|
|
1424
|
+
def __repr__(self) -> str:
|
|
1425
|
+
...
|
|
1426
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1427
|
+
...
|
|
1428
|
+
def __str__(self) -> str:
|
|
1429
|
+
...
|
|
1430
|
+
@property
|
|
1431
|
+
def name(self) -> str:
|
|
1432
|
+
...
|
|
1433
|
+
@property
|
|
1434
|
+
def value(self) -> int:
|
|
1435
|
+
...
|
|
1436
|
+
class ASA_STRATEGY:
|
|
1437
|
+
"""
|
|
1438
|
+
Enumeration type for ASA method
|
|
1439
|
+
|
|
1440
|
+
Members:
|
|
1441
|
+
|
|
1442
|
+
HERMITE : Cubic Hermite interpolation
|
|
1443
|
+
|
|
1444
|
+
POLYNOMIAL : Variable degree polynomial interpolation
|
|
1445
|
+
"""
|
|
1446
|
+
HERMITE: typing.ClassVar[ODESLV.Options.ASA_STRATEGY]
|
|
1447
|
+
POLYNOMIAL: typing.ClassVar[ODESLV.Options.ASA_STRATEGY]
|
|
1448
|
+
__members__: typing.ClassVar[dict[str, ODESLV.Options.ASA_STRATEGY]]
|
|
1449
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1450
|
+
...
|
|
1451
|
+
def __getstate__(self) -> int:
|
|
1452
|
+
...
|
|
1453
|
+
def __hash__(self) -> int:
|
|
1454
|
+
...
|
|
1455
|
+
def __index__(self) -> int:
|
|
1456
|
+
...
|
|
1457
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1458
|
+
...
|
|
1459
|
+
def __int__(self) -> int:
|
|
1460
|
+
...
|
|
1461
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1462
|
+
...
|
|
1463
|
+
def __repr__(self) -> str:
|
|
1464
|
+
...
|
|
1465
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1466
|
+
...
|
|
1467
|
+
def __str__(self) -> str:
|
|
1468
|
+
...
|
|
1469
|
+
@property
|
|
1470
|
+
def name(self) -> str:
|
|
1471
|
+
...
|
|
1472
|
+
@property
|
|
1473
|
+
def value(self) -> int:
|
|
1474
|
+
...
|
|
1475
|
+
class INTEGRATION_METHOD:
|
|
1476
|
+
"""
|
|
1477
|
+
Enumeration of numerical integration algorithms
|
|
1478
|
+
|
|
1479
|
+
Members:
|
|
1480
|
+
|
|
1481
|
+
MSADAMS : Variable-coefficient linear multistep Adams method (non-stiff systems)
|
|
1482
|
+
|
|
1483
|
+
MSBDF : Variable-coefficient linear multistep backward differentiation formula (BDF) method (stiff systems)
|
|
1484
|
+
"""
|
|
1485
|
+
MSADAMS: typing.ClassVar[ODESLV.Options.INTEGRATION_METHOD]
|
|
1486
|
+
MSBDF: typing.ClassVar[ODESLV.Options.INTEGRATION_METHOD]
|
|
1487
|
+
__members__: typing.ClassVar[dict[str, ODESLV.Options.INTEGRATION_METHOD]]
|
|
1488
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1489
|
+
...
|
|
1490
|
+
def __getstate__(self) -> int:
|
|
1491
|
+
...
|
|
1492
|
+
def __hash__(self) -> int:
|
|
1493
|
+
...
|
|
1494
|
+
def __index__(self) -> int:
|
|
1495
|
+
...
|
|
1496
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1497
|
+
...
|
|
1498
|
+
def __int__(self) -> int:
|
|
1499
|
+
...
|
|
1500
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1501
|
+
...
|
|
1502
|
+
def __repr__(self) -> str:
|
|
1503
|
+
...
|
|
1504
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1505
|
+
...
|
|
1506
|
+
def __str__(self) -> str:
|
|
1507
|
+
...
|
|
1508
|
+
@property
|
|
1509
|
+
def name(self) -> str:
|
|
1510
|
+
...
|
|
1511
|
+
@property
|
|
1512
|
+
def value(self) -> int:
|
|
1513
|
+
...
|
|
1514
|
+
class NONLINEAR_SOLVER:
|
|
1515
|
+
"""
|
|
1516
|
+
Enumeration of nonlinear solver strategies
|
|
1517
|
+
|
|
1518
|
+
Members:
|
|
1519
|
+
|
|
1520
|
+
FIXEDPOINT : Fixed point nonlinear solver
|
|
1521
|
+
|
|
1522
|
+
NEWTON : Newton nonlinear solver
|
|
1523
|
+
"""
|
|
1524
|
+
FIXEDPOINT: typing.ClassVar[ODESLV.Options.NONLINEAR_SOLVER]
|
|
1525
|
+
NEWTON: typing.ClassVar[ODESLV.Options.NONLINEAR_SOLVER]
|
|
1526
|
+
__members__: typing.ClassVar[dict[str, ODESLV.Options.NONLINEAR_SOLVER]]
|
|
1527
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1528
|
+
...
|
|
1529
|
+
def __getstate__(self) -> int:
|
|
1530
|
+
...
|
|
1531
|
+
def __hash__(self) -> int:
|
|
1532
|
+
...
|
|
1533
|
+
def __index__(self) -> int:
|
|
1534
|
+
...
|
|
1535
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1536
|
+
...
|
|
1537
|
+
def __int__(self) -> int:
|
|
1538
|
+
...
|
|
1539
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1540
|
+
...
|
|
1541
|
+
def __repr__(self) -> str:
|
|
1542
|
+
...
|
|
1543
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1544
|
+
...
|
|
1545
|
+
def __str__(self) -> str:
|
|
1546
|
+
...
|
|
1547
|
+
@property
|
|
1548
|
+
def name(self) -> str:
|
|
1549
|
+
...
|
|
1550
|
+
@property
|
|
1551
|
+
def value(self) -> int:
|
|
1552
|
+
...
|
|
1553
|
+
class LINEAR_SOLVER:
|
|
1554
|
+
"""
|
|
1555
|
+
Enumeration of linear solver strategies (within Newton nonlinear solver)
|
|
1556
|
+
|
|
1557
|
+
Members:
|
|
1558
|
+
|
|
1559
|
+
DIAG : Approximate diagonal Jacobian formed by way of a difference quotient
|
|
1560
|
+
|
|
1561
|
+
DENSE : Use analytic dense Jacobian and internal direct dense linear algebra functions
|
|
1562
|
+
|
|
1563
|
+
DENSEDQ : Use approximate dense Jacobian by way of a difference quotient and internal direct dense linear algebra
|
|
1564
|
+
|
|
1565
|
+
SPARSE : Use analytic sparse Jacobian and the KLU sparse direct solver. Requires a build with KLU
|
|
1566
|
+
"""
|
|
1567
|
+
DENSE: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1568
|
+
DENSEDQ: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1569
|
+
DIAG: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1570
|
+
SPARSE: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1571
|
+
__members__: typing.ClassVar[dict[str, ODESLV.Options.LINEAR_SOLVER]]
|
|
1572
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1573
|
+
...
|
|
1574
|
+
def __getstate__(self) -> int:
|
|
1575
|
+
...
|
|
1576
|
+
def __hash__(self) -> int:
|
|
1577
|
+
...
|
|
1578
|
+
def __index__(self) -> int:
|
|
1579
|
+
...
|
|
1580
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1581
|
+
...
|
|
1582
|
+
def __int__(self) -> int:
|
|
1583
|
+
...
|
|
1584
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1585
|
+
...
|
|
1586
|
+
def __repr__(self) -> str:
|
|
1587
|
+
...
|
|
1588
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1589
|
+
...
|
|
1590
|
+
def __str__(self) -> str:
|
|
1591
|
+
...
|
|
1592
|
+
@property
|
|
1593
|
+
def name(self) -> str:
|
|
1594
|
+
...
|
|
1595
|
+
@property
|
|
1596
|
+
def value(self) -> int:
|
|
1597
|
+
...
|
|
1598
|
+
DENSE: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1599
|
+
DENSEDQ: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1600
|
+
DIAG: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1601
|
+
FIXEDPOINT: typing.ClassVar[ODESLV.Options.NONLINEAR_SOLVER]
|
|
1602
|
+
HERMITE: typing.ClassVar[ODESLV.Options.ASA_STRATEGY]
|
|
1603
|
+
MSADAMS: typing.ClassVar[ODESLV.Options.INTEGRATION_METHOD]
|
|
1604
|
+
MSBDF: typing.ClassVar[ODESLV.Options.INTEGRATION_METHOD]
|
|
1605
|
+
NEWTON: typing.ClassVar[ODESLV.Options.NONLINEAR_SOLVER]
|
|
1606
|
+
POLYNOMIAL: typing.ClassVar[ODESLV.Options.ASA_STRATEGY]
|
|
1607
|
+
SIMULTANEOUS: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1608
|
+
SPARSE: typing.ClassVar[ODESLV.Options.LINEAR_SOLVER]
|
|
1609
|
+
STAGGERED: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1610
|
+
STAGGERED1: typing.ClassVar[ODESLV.Options.FSA_STRATEGY]
|
|
1611
|
+
@typing.overload
|
|
1612
|
+
def __init__(self) -> None:
|
|
1613
|
+
...
|
|
1614
|
+
@typing.overload
|
|
1615
|
+
def __init__(self, arg0: ODESLV.Options) -> None:
|
|
1616
|
+
...
|
|
1617
|
+
@property
|
|
1618
|
+
def ASACHKPT(self) -> int:
|
|
1619
|
+
"""
|
|
1620
|
+
Number of steps between each check point for ASA
|
|
1621
|
+
"""
|
|
1622
|
+
@ASACHKPT.setter
|
|
1623
|
+
def ASACHKPT(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1624
|
+
...
|
|
1625
|
+
@property
|
|
1626
|
+
def ASAINTERP(self) -> ODESLV.Options.ASA_STRATEGY:
|
|
1627
|
+
"""
|
|
1628
|
+
ASA interpolation strategy
|
|
1629
|
+
"""
|
|
1630
|
+
@ASAINTERP.setter
|
|
1631
|
+
def ASAINTERP(self, arg0: ODESLV.Options.ASA_STRATEGY) -> None:
|
|
1632
|
+
...
|
|
1633
|
+
@property
|
|
1634
|
+
def ATOL(self) -> float:
|
|
1635
|
+
"""
|
|
1636
|
+
Absolute (scalar) integration tolerance
|
|
1637
|
+
"""
|
|
1638
|
+
@ATOL.setter
|
|
1639
|
+
def ATOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1640
|
+
...
|
|
1641
|
+
@property
|
|
1642
|
+
def ATOLB(self) -> float:
|
|
1643
|
+
"""
|
|
1644
|
+
Absolute (scalar) integration tolerance for ASA
|
|
1645
|
+
"""
|
|
1646
|
+
@ATOLB.setter
|
|
1647
|
+
def ATOLB(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1648
|
+
...
|
|
1649
|
+
@property
|
|
1650
|
+
def ATOLS(self) -> float:
|
|
1651
|
+
"""
|
|
1652
|
+
Absolute (scalar) integration tolerance for FSA
|
|
1653
|
+
"""
|
|
1654
|
+
@ATOLS.setter
|
|
1655
|
+
def ATOLS(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1656
|
+
...
|
|
1657
|
+
@property
|
|
1658
|
+
def AUTOTOLS(self) -> bool:
|
|
1659
|
+
"""
|
|
1660
|
+
Whether integration tolerances for FS are to be set automatically?
|
|
1661
|
+
"""
|
|
1662
|
+
@AUTOTOLS.setter
|
|
1663
|
+
def AUTOTOLS(self, arg0: bool) -> None:
|
|
1664
|
+
...
|
|
1665
|
+
@property
|
|
1666
|
+
def DISPLAY(self) -> int:
|
|
1667
|
+
"""
|
|
1668
|
+
Display level (default: 1)
|
|
1669
|
+
"""
|
|
1670
|
+
@DISPLAY.setter
|
|
1671
|
+
def DISPLAY(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1672
|
+
...
|
|
1673
|
+
@property
|
|
1674
|
+
def ETOL(self) -> float:
|
|
1675
|
+
"""
|
|
1676
|
+
Absolute (scalar) integration tolerance for ellipsoid shape matrix
|
|
1677
|
+
"""
|
|
1678
|
+
@ETOL.setter
|
|
1679
|
+
def ETOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1680
|
+
...
|
|
1681
|
+
@property
|
|
1682
|
+
def ETOLB(self) -> float:
|
|
1683
|
+
"""
|
|
1684
|
+
Absolute (scalar) integration tolerance for ellipsoid shape matrix in ASA
|
|
1685
|
+
"""
|
|
1686
|
+
@ETOLB.setter
|
|
1687
|
+
def ETOLB(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1688
|
+
...
|
|
1689
|
+
@property
|
|
1690
|
+
def ETOLS(self) -> float:
|
|
1691
|
+
"""
|
|
1692
|
+
Absolute (scalar) integration tolerance for ellipsoid shape matrix in FSA
|
|
1693
|
+
"""
|
|
1694
|
+
@ETOLS.setter
|
|
1695
|
+
def ETOLS(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1696
|
+
...
|
|
1697
|
+
@property
|
|
1698
|
+
def FSACORR(self) -> ODESLV.Options.FSA_STRATEGY:
|
|
1699
|
+
"""
|
|
1700
|
+
FSA correction strategy
|
|
1701
|
+
"""
|
|
1702
|
+
@FSACORR.setter
|
|
1703
|
+
def FSACORR(self, arg0: ODESLV.Options.FSA_STRATEGY) -> None:
|
|
1704
|
+
...
|
|
1705
|
+
@property
|
|
1706
|
+
def FSAERR(self) -> bool:
|
|
1707
|
+
"""
|
|
1708
|
+
Whether or not FSA error control is performed?
|
|
1709
|
+
"""
|
|
1710
|
+
@FSAERR.setter
|
|
1711
|
+
def FSAERR(self, arg0: bool) -> None:
|
|
1712
|
+
...
|
|
1713
|
+
@property
|
|
1714
|
+
def H0(self) -> float:
|
|
1715
|
+
"""
|
|
1716
|
+
Initial step-size [Default: 0e0 (auto)]
|
|
1717
|
+
"""
|
|
1718
|
+
@H0.setter
|
|
1719
|
+
def H0(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1720
|
+
...
|
|
1721
|
+
@property
|
|
1722
|
+
def HMAX(self) -> float:
|
|
1723
|
+
"""
|
|
1724
|
+
Maximum step-size [Default: 0e0 (+inf)]
|
|
1725
|
+
"""
|
|
1726
|
+
@HMAX.setter
|
|
1727
|
+
def HMAX(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1728
|
+
...
|
|
1729
|
+
@property
|
|
1730
|
+
def HMIN(self) -> float:
|
|
1731
|
+
"""
|
|
1732
|
+
Minimum step-size [Default: 0e0]
|
|
1733
|
+
"""
|
|
1734
|
+
@HMIN.setter
|
|
1735
|
+
def HMIN(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1736
|
+
...
|
|
1737
|
+
@property
|
|
1738
|
+
def INTMETH(self) -> ODESLV.Options.INTEGRATION_METHOD:
|
|
1739
|
+
"""
|
|
1740
|
+
Numerical integration method [Default: MSBDF]
|
|
1741
|
+
"""
|
|
1742
|
+
@INTMETH.setter
|
|
1743
|
+
def INTMETH(self, arg0: ODESLV.Options.INTEGRATION_METHOD) -> None:
|
|
1744
|
+
...
|
|
1745
|
+
@property
|
|
1746
|
+
def LINSOL(self) -> ODESLV.Options.LINEAR_SOLVER:
|
|
1747
|
+
"""
|
|
1748
|
+
Linear solver method and Jacobian approximation [Default: DIAG]
|
|
1749
|
+
"""
|
|
1750
|
+
@LINSOL.setter
|
|
1751
|
+
def LINSOL(self, arg0: ODESLV.Options.LINEAR_SOLVER) -> None:
|
|
1752
|
+
...
|
|
1753
|
+
@property
|
|
1754
|
+
def MAXCORR(self) -> int:
|
|
1755
|
+
"""
|
|
1756
|
+
Maximum number of nonlinear solver iterations per step
|
|
1757
|
+
"""
|
|
1758
|
+
@MAXCORR.setter
|
|
1759
|
+
def MAXCORR(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1760
|
+
...
|
|
1761
|
+
@property
|
|
1762
|
+
def MAXFAIL(self) -> int:
|
|
1763
|
+
"""
|
|
1764
|
+
Maximum number of error test failures per step
|
|
1765
|
+
"""
|
|
1766
|
+
@MAXFAIL.setter
|
|
1767
|
+
def MAXFAIL(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1768
|
+
...
|
|
1769
|
+
@property
|
|
1770
|
+
def NLINSOL(self) -> ODESLV.Options.NONLINEAR_SOLVER:
|
|
1771
|
+
"""
|
|
1772
|
+
Nonlinear solver method [Default: NEWTON]
|
|
1773
|
+
"""
|
|
1774
|
+
@NLINSOL.setter
|
|
1775
|
+
def NLINSOL(self, arg0: ODESLV.Options.NONLINEAR_SOLVER) -> None:
|
|
1776
|
+
...
|
|
1777
|
+
@property
|
|
1778
|
+
def NMAX(self) -> int:
|
|
1779
|
+
"""
|
|
1780
|
+
Maximum number of steps in a time stage [Default: 0 (2000)]
|
|
1781
|
+
"""
|
|
1782
|
+
@NMAX.setter
|
|
1783
|
+
def NMAX(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1784
|
+
...
|
|
1785
|
+
@property
|
|
1786
|
+
def QERR(self) -> bool:
|
|
1787
|
+
"""
|
|
1788
|
+
Whether or not (state) quadrature error control is performed?
|
|
1789
|
+
"""
|
|
1790
|
+
@QERR.setter
|
|
1791
|
+
def QERR(self, arg0: bool) -> None:
|
|
1792
|
+
...
|
|
1793
|
+
@property
|
|
1794
|
+
def QERRB(self) -> bool:
|
|
1795
|
+
"""
|
|
1796
|
+
Whether or not ASA quadrature error control is performed?
|
|
1797
|
+
"""
|
|
1798
|
+
@QERRB.setter
|
|
1799
|
+
def QERRB(self, arg0: bool) -> None:
|
|
1800
|
+
...
|
|
1801
|
+
@property
|
|
1802
|
+
def QERRS(self) -> bool:
|
|
1803
|
+
"""
|
|
1804
|
+
Whether or not FSA quadrature error control is performed?
|
|
1805
|
+
"""
|
|
1806
|
+
@QERRS.setter
|
|
1807
|
+
def QERRS(self, arg0: bool) -> None:
|
|
1808
|
+
...
|
|
1809
|
+
@property
|
|
1810
|
+
def RESRECORD(self) -> int:
|
|
1811
|
+
"""
|
|
1812
|
+
Whether or not to record results (default: 0)
|
|
1813
|
+
"""
|
|
1814
|
+
@RESRECORD.setter
|
|
1815
|
+
def RESRECORD(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
1816
|
+
...
|
|
1817
|
+
@property
|
|
1818
|
+
def RTOL(self) -> float:
|
|
1819
|
+
"""
|
|
1820
|
+
Relative (scalar) integration tolerance
|
|
1821
|
+
"""
|
|
1822
|
+
@RTOL.setter
|
|
1823
|
+
def RTOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1824
|
+
...
|
|
1825
|
+
@property
|
|
1826
|
+
def RTOLB(self) -> float:
|
|
1827
|
+
"""
|
|
1828
|
+
Relative (scalar) integration tolerance for ASA
|
|
1829
|
+
"""
|
|
1830
|
+
@RTOLB.setter
|
|
1831
|
+
def RTOLB(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1832
|
+
...
|
|
1833
|
+
@property
|
|
1834
|
+
def RTOLS(self) -> float:
|
|
1835
|
+
"""
|
|
1836
|
+
Relative (scalar) integration tolerance for FSA
|
|
1837
|
+
"""
|
|
1838
|
+
@RTOLS.setter
|
|
1839
|
+
def RTOLS(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
1840
|
+
...
|
|
1841
|
+
class ResultsSolve:
|
|
1842
|
+
"""
|
|
1843
|
+
Trajectories recorded by the last ``solve`` (``options.RESRECORD`` points), as
|
|
1844
|
+
NumPy arrays.
|
|
1845
|
+
"""
|
|
1846
|
+
@property
|
|
1847
|
+
def q(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1848
|
+
"""
|
|
1849
|
+
Quadratures, shape (n, nq).
|
|
1850
|
+
"""
|
|
1851
|
+
@property
|
|
1852
|
+
def t(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1853
|
+
"""
|
|
1854
|
+
Time points, shape (n,); a stage boundary appears twice (values on either side).
|
|
1855
|
+
"""
|
|
1856
|
+
@property
|
|
1857
|
+
def x(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1858
|
+
"""
|
|
1859
|
+
States, shape (n, nx), in the order of ``var_state``.
|
|
1860
|
+
"""
|
|
1861
|
+
class ResultsFsens:
|
|
1862
|
+
"""
|
|
1863
|
+
Trajectories recorded by the last ``solve_fsens``, as NumPy arrays: one block
|
|
1864
|
+
per sensitivity direction (``sensitivity_index``).
|
|
1865
|
+
"""
|
|
1866
|
+
@property
|
|
1867
|
+
def qp(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1868
|
+
"""
|
|
1869
|
+
Quadrature sensitivities, shape (nsen, n, nq).
|
|
1870
|
+
"""
|
|
1871
|
+
@property
|
|
1872
|
+
def t(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1873
|
+
"""
|
|
1874
|
+
Time points, shape (n,); a stage boundary appears twice (values on either side).
|
|
1875
|
+
"""
|
|
1876
|
+
@property
|
|
1877
|
+
def xp(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1878
|
+
"""
|
|
1879
|
+
State sensitivities, shape (nsen, n, nx).
|
|
1880
|
+
"""
|
|
1881
|
+
class ResultsAsens:
|
|
1882
|
+
"""
|
|
1883
|
+
Trajectories recorded by the last ``solve_asens``, as NumPy arrays: one block
|
|
1884
|
+
per output function, in ASCENDING time (the adjoint integration runs
|
|
1885
|
+
backward).
|
|
1886
|
+
"""
|
|
1887
|
+
@property
|
|
1888
|
+
def l(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1889
|
+
"""
|
|
1890
|
+
Adjoint states, shape (nf, n, nx).
|
|
1891
|
+
"""
|
|
1892
|
+
@property
|
|
1893
|
+
def qp(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1894
|
+
"""
|
|
1895
|
+
Running gradient of each output with respect to the sensitivity directions,
|
|
1896
|
+
shape (nf, n, nsen); its value at t = 0 is the gradient.
|
|
1897
|
+
"""
|
|
1898
|
+
@property
|
|
1899
|
+
def t(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
1900
|
+
"""
|
|
1901
|
+
Time points, ascending, shape (n,); a stage boundary appears twice.
|
|
1902
|
+
"""
|
|
1903
|
+
class Stats:
|
|
1904
|
+
"""
|
|
1905
|
+
Statistics of an integration.
|
|
1906
|
+
"""
|
|
1907
|
+
@property
|
|
1908
|
+
def cputime(self) -> float:
|
|
1909
|
+
"""
|
|
1910
|
+
CPU time (seconds).
|
|
1911
|
+
"""
|
|
1912
|
+
@property
|
|
1913
|
+
def numJAC(self) -> int:
|
|
1914
|
+
"""
|
|
1915
|
+
Number of Jacobian evaluations.
|
|
1916
|
+
"""
|
|
1917
|
+
@property
|
|
1918
|
+
def numRHS(self) -> int:
|
|
1919
|
+
"""
|
|
1920
|
+
Number of right-hand-side evaluations.
|
|
1921
|
+
"""
|
|
1922
|
+
@property
|
|
1923
|
+
def numSteps(self) -> int:
|
|
1924
|
+
"""
|
|
1925
|
+
Number of steps.
|
|
1926
|
+
"""
|
|
1927
|
+
FAILURE: typing.ClassVar[ODESLV.STATUS]
|
|
1928
|
+
FATAL: typing.ClassVar[ODESLV.STATUS]
|
|
1929
|
+
NORMAL: typing.ClassVar[ODESLV.STATUS]
|
|
1930
|
+
@staticmethod
|
|
1931
|
+
def revision() -> str:
|
|
1932
|
+
"""
|
|
1933
|
+
The revision of the ODESLV headers (odeslv_base.hpp and the three that change with it), e.g.
|
|
1934
|
+
for a bug report; FFModel.revision() gives the model layer's.
|
|
1935
|
+
"""
|
|
1936
|
+
def __init__(self, dag: pymcpp.FFGraph) -> None:
|
|
1937
|
+
"""
|
|
1938
|
+
Empty solver and model on the DAG ``dag`` (kept alive by it).
|
|
1939
|
+
"""
|
|
1940
|
+
def blk_fct(self, ndx: typing.SupportsInt | typing.SupportsIndex) -> tuple[int, int]:
|
|
1941
|
+
"""
|
|
1942
|
+
The block of output ``ndx`` (in add_output() order) in ``val_function()``:
|
|
1943
|
+
``(first, count)``. An ODESLV integrates a lumped system and returns one value
|
|
1944
|
+
per output, so the block is ``(ndx, 1)``. The same call exists on ``OCFESLV``,
|
|
1945
|
+
where a distributed output spans several values.
|
|
1946
|
+
"""
|
|
1947
|
+
def extract_error(self) -> str:
|
|
1948
|
+
"""
|
|
1949
|
+
Why the model could not be extracted as an ODE system (empty if it could).
|
|
1950
|
+
"""
|
|
1951
|
+
def get_parameter_values(self, var: pymcpp.FFVar, p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex]) -> list[float]:
|
|
1952
|
+
"""
|
|
1953
|
+
The values of input ``var`` in the parameter vector ``p``.
|
|
1954
|
+
"""
|
|
1955
|
+
def nf(self) -> int:
|
|
1956
|
+
"""
|
|
1957
|
+
Number of output functions.
|
|
1958
|
+
"""
|
|
1959
|
+
def np(self) -> int:
|
|
1960
|
+
"""
|
|
1961
|
+
Number of parameters.
|
|
1962
|
+
"""
|
|
1963
|
+
def nq(self) -> int:
|
|
1964
|
+
"""
|
|
1965
|
+
Number of quadratures.
|
|
1966
|
+
"""
|
|
1967
|
+
def ns(self) -> int:
|
|
1968
|
+
"""
|
|
1969
|
+
Number of stages.
|
|
1970
|
+
"""
|
|
1971
|
+
def nx(self) -> int:
|
|
1972
|
+
"""
|
|
1973
|
+
Number of states.
|
|
1974
|
+
"""
|
|
1975
|
+
def parameter_index(self, var: pymcpp.FFVar) -> list[int]:
|
|
1976
|
+
"""
|
|
1977
|
+
Positions of input ``var``'s values in the parameter vector.
|
|
1978
|
+
"""
|
|
1979
|
+
def pos_input(self, var: pymcpp.FFVar, ndx_el: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsInt | typing.SupportsIndex] = {}) -> int:
|
|
1980
|
+
"""
|
|
1981
|
+
Position of input ``var`` (in element ``ndx_el``) in the parameter vector.
|
|
1982
|
+
"""
|
|
1983
|
+
def set_parameter_values(self, var: pymcpp.FFVar, values: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex]) -> list[float]:
|
|
1984
|
+
"""
|
|
1985
|
+
Return a copy of the parameter vector ``p`` with the values of input ``var``
|
|
1986
|
+
replaced by ``values``.
|
|
1987
|
+
"""
|
|
1988
|
+
def setup(self) -> bool:
|
|
1989
|
+
"""
|
|
1990
|
+
Analyse the model and build the integrator; returns False on failure (see
|
|
1991
|
+
``extract_error`` and ``setup_status``). Output written by C++ is redirected
|
|
1992
|
+
to Python's ``sys.stdout`` / ``sys.stderr``.
|
|
1993
|
+
"""
|
|
1994
|
+
@typing.overload
|
|
1995
|
+
def solve(self, p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], c: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> ODESLV.STATUS:
|
|
1996
|
+
"""
|
|
1997
|
+
Integrate the model.
|
|
1998
|
+
|
|
1999
|
+
Parameters
|
|
2000
|
+
----------
|
|
2001
|
+
p : list of float
|
|
2002
|
+
Parameter values, in the order of ``var_parameter``.
|
|
2003
|
+
c : list of float, optional
|
|
2004
|
+
Constant values, in the order of ``var_constant``.
|
|
2005
|
+
|
|
2006
|
+
Returns
|
|
2007
|
+
-------
|
|
2008
|
+
ODESLV.STATUS
|
|
2009
|
+
"""
|
|
2010
|
+
@typing.overload
|
|
2011
|
+
def solve(self, inputs: collections.abc.Mapping[pymcpp.FFVar, collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | collections.abc.Callable[[FFModel.DofIndex], float]]) -> ODESLV.STATUS:
|
|
2012
|
+
"""
|
|
2013
|
+
Integrate the model.
|
|
2014
|
+
|
|
2015
|
+
The values are given BY NAME: a dict mapping every declared input and constant
|
|
2016
|
+
to its values -- a list (one value for a parameter or a constant; one per DOF
|
|
2017
|
+
for a distributed input, in the order of ``control_dofs``) or a generator
|
|
2018
|
+
``gen(dof: FFModel.DofIndex) -> float``. An incomplete or inconsistent dict
|
|
2019
|
+
raises ``ValueError``, naming the entry.
|
|
2020
|
+
"""
|
|
2021
|
+
@typing.overload
|
|
2022
|
+
def solve_asens(self, p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], c: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> ODESLV.STATUS:
|
|
2023
|
+
"""
|
|
2024
|
+
Integrate the model forward and its adjoints backward, for the gradients of
|
|
2025
|
+
the outputs with respect to the sensitivity directions. Arguments as
|
|
2026
|
+
``solve``.
|
|
2027
|
+
"""
|
|
2028
|
+
@typing.overload
|
|
2029
|
+
def solve_asens(self, inputs: collections.abc.Mapping[pymcpp.FFVar, collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | collections.abc.Callable[[FFModel.DofIndex], float]]) -> ODESLV.STATUS:
|
|
2030
|
+
"""
|
|
2031
|
+
Integrate the model and its adjoints.
|
|
2032
|
+
|
|
2033
|
+
The values are given BY NAME: a dict mapping every declared input and constant
|
|
2034
|
+
to its values -- a list (one value for a parameter or a constant; one per DOF
|
|
2035
|
+
for a distributed input, in the order of ``control_dofs``) or a generator
|
|
2036
|
+
``gen(dof: FFModel.DofIndex) -> float``. An incomplete or inconsistent dict
|
|
2037
|
+
raises ``ValueError``, naming the entry.
|
|
2038
|
+
"""
|
|
2039
|
+
@typing.overload
|
|
2040
|
+
def solve_fsens(self, p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], c: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = []) -> ODESLV.STATUS:
|
|
2041
|
+
"""
|
|
2042
|
+
Integrate the model and its forward sensitivities with respect to the
|
|
2043
|
+
sensitivity directions (``sensitivity_index``: the control DOFs, or every
|
|
2044
|
+
parameter when no control is registered). Arguments as ``solve``.
|
|
2045
|
+
"""
|
|
2046
|
+
@typing.overload
|
|
2047
|
+
def solve_fsens(self, inputs: collections.abc.Mapping[pymcpp.FFVar, collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | collections.abc.Callable[[FFModel.DofIndex], float]]) -> ODESLV.STATUS:
|
|
2048
|
+
"""
|
|
2049
|
+
Integrate the model and its forward sensitivities.
|
|
2050
|
+
|
|
2051
|
+
The values are given BY NAME: a dict mapping every declared input and constant
|
|
2052
|
+
to its values -- a list (one value for a parameter or a constant; one per DOF
|
|
2053
|
+
for a distributed input, in the order of ``control_dofs``) or a generator
|
|
2054
|
+
``gen(dof: FFModel.DofIndex) -> float``. An incomplete or inconsistent dict
|
|
2055
|
+
raises ``ValueError``, naming the entry.
|
|
2056
|
+
"""
|
|
2057
|
+
def val_function(self) -> list[float]:
|
|
2058
|
+
"""
|
|
2059
|
+
Output values after the last solve.
|
|
2060
|
+
"""
|
|
2061
|
+
@typing.overload
|
|
2062
|
+
def val_function_gradient(self) -> list[list[float]]:
|
|
2063
|
+
"""
|
|
2064
|
+
Output gradients after the last sensitivity solve: one row per sensitivity
|
|
2065
|
+
direction (``sensitivity_index``), one column per output.
|
|
2066
|
+
"""
|
|
2067
|
+
@typing.overload
|
|
2068
|
+
def val_function_gradient(self, var: pymcpp.FFVar) -> list[list[float]]:
|
|
2069
|
+
"""
|
|
2070
|
+
Output gradients with respect to the DOFs of the control ``var`` only: one row
|
|
2071
|
+
per DOF (in the order of ``control_dofs``), one column per output.
|
|
2072
|
+
"""
|
|
2073
|
+
@typing.overload
|
|
2074
|
+
def val_function_gradient(self, var: pymcpp.FFVar, ndx_el: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsInt | typing.SupportsIndex]) -> list[list[float]]:
|
|
2075
|
+
"""
|
|
2076
|
+
Output gradients with respect to the DOFs of the control ``var`` in one
|
|
2077
|
+
element, ``{evolution domain: element}`` (ignored for a time-invariant
|
|
2078
|
+
control).
|
|
2079
|
+
"""
|
|
2080
|
+
def val_state(self) -> list[list[float]]:
|
|
2081
|
+
"""
|
|
2082
|
+
State values at the stage times after the last solve.
|
|
2083
|
+
"""
|
|
2084
|
+
@property
|
|
2085
|
+
def options(self) -> ODESLV.Options:
|
|
2086
|
+
"""
|
|
2087
|
+
Solver options (model and CVODES).
|
|
2088
|
+
"""
|
|
2089
|
+
@options.setter
|
|
2090
|
+
def options(self, arg1: ODESLV.Options) -> None:
|
|
2091
|
+
...
|
|
2092
|
+
@property
|
|
2093
|
+
def results_asens(self) -> ODESLV.ResultsAsens:
|
|
2094
|
+
"""
|
|
2095
|
+
Trajectories of the last ``solve_asens``, as NumPy arrays (ascending time).
|
|
2096
|
+
"""
|
|
2097
|
+
@property
|
|
2098
|
+
def results_fsens(self) -> ODESLV.ResultsFsens:
|
|
2099
|
+
"""
|
|
2100
|
+
Trajectories of the last ``solve_fsens``, as NumPy arrays.
|
|
2101
|
+
"""
|
|
2102
|
+
@property
|
|
2103
|
+
def results_solve(self) -> ODESLV.ResultsSolve:
|
|
2104
|
+
"""
|
|
2105
|
+
Trajectories of the last ``solve`` (``options.RESRECORD``), as NumPy arrays.
|
|
2106
|
+
"""
|
|
2107
|
+
@property
|
|
2108
|
+
def sensitivity_index(self) -> list[int]:
|
|
2109
|
+
"""
|
|
2110
|
+
Parameter positions of the sensitivity directions, in order.
|
|
2111
|
+
"""
|
|
2112
|
+
@property
|
|
2113
|
+
def stats_asens(self) -> ODESLV.Stats:
|
|
2114
|
+
"""
|
|
2115
|
+
Statistics of the last ``solve_asens``.
|
|
2116
|
+
"""
|
|
2117
|
+
@property
|
|
2118
|
+
def stats_fsens(self) -> ODESLV.Stats:
|
|
2119
|
+
"""
|
|
2120
|
+
Statistics of the last ``solve_fsens``.
|
|
2121
|
+
"""
|
|
2122
|
+
@property
|
|
2123
|
+
def stats_solve(self) -> ODESLV.Stats:
|
|
2124
|
+
"""
|
|
2125
|
+
Statistics of the last ``solve``.
|
|
2126
|
+
"""
|
|
2127
|
+
@property
|
|
2128
|
+
def var_parameter(self) -> list[pymcpp.FFVar]:
|
|
2129
|
+
"""
|
|
2130
|
+
The parameter vector the solver integrates against: the time-invariant inputs
|
|
2131
|
+
and, for each time-varying input, its per-element nodal values.
|
|
2132
|
+
"""
|
|
2133
|
+
class FFODESLV(pymcpp.FFOp):
|
|
2134
|
+
"""
|
|
2135
|
+
An ODESLV solve embedded as an operation of the DAG: its outputs become DAG
|
|
2136
|
+
variables, functions of the DAG variables given for the solver's inputs and
|
|
2137
|
+
constants. Evaluating them integrates the model; differentiating them (FFGraph
|
|
2138
|
+
``fdiff`` / ``bdiff``) uses forward or adjoint sensitivities
|
|
2139
|
+
(``options.GRADIENT``), through FFGradODESLV.
|
|
2140
|
+
|
|
2141
|
+
Example -- x(1) for x' = -p x, x(0) = 1, as a DAG variable of P:
|
|
2142
|
+
|
|
2143
|
+
>>> OpODE = FFODESLV()
|
|
2144
|
+
>>> P = G.add_var("P")
|
|
2145
|
+
>>> y = OpODE({p: [P]}, solver) # every input differentiated, no constant
|
|
2146
|
+
>>> G.eval(y, [P], [0.7]) # [exp(-0.7)]
|
|
2147
|
+
"""
|
|
2148
|
+
class POLICY_TYPE:
|
|
2149
|
+
"""
|
|
2150
|
+
Copy policy of the embedded solver.
|
|
2151
|
+
|
|
2152
|
+
Members:
|
|
2153
|
+
|
|
2154
|
+
SHALLOW : Refer to the solver (kept alive as long as the DAG)
|
|
2155
|
+
|
|
2156
|
+
COPY : Hold a deep copy of the solver (default)
|
|
2157
|
+
|
|
2158
|
+
TRANSFER : Not available from Python (ownership transfer)
|
|
2159
|
+
"""
|
|
2160
|
+
COPY: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2161
|
+
SHALLOW: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2162
|
+
TRANSFER: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2163
|
+
__members__: typing.ClassVar[dict[str, FFODESLV.POLICY_TYPE]]
|
|
2164
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2165
|
+
...
|
|
2166
|
+
def __getstate__(self) -> int:
|
|
2167
|
+
...
|
|
2168
|
+
def __hash__(self) -> int:
|
|
2169
|
+
...
|
|
2170
|
+
def __index__(self) -> int:
|
|
2171
|
+
...
|
|
2172
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2173
|
+
...
|
|
2174
|
+
def __int__(self) -> int:
|
|
2175
|
+
...
|
|
2176
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2177
|
+
...
|
|
2178
|
+
def __repr__(self) -> str:
|
|
2179
|
+
...
|
|
2180
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2181
|
+
...
|
|
2182
|
+
def __str__(self) -> str:
|
|
2183
|
+
...
|
|
2184
|
+
@property
|
|
2185
|
+
def name(self) -> str:
|
|
2186
|
+
...
|
|
2187
|
+
@property
|
|
2188
|
+
def value(self) -> int:
|
|
2189
|
+
...
|
|
2190
|
+
class GRADIENT_TYPE:
|
|
2191
|
+
"""
|
|
2192
|
+
Sensitivity mode of derivatives.
|
|
2193
|
+
|
|
2194
|
+
Members:
|
|
2195
|
+
|
|
2196
|
+
FORWARD : Forward sensitivities (one direction per parameter)
|
|
2197
|
+
|
|
2198
|
+
ADJOINT : Adjoint sensitivities (one backward sweep per output)
|
|
2199
|
+
|
|
2200
|
+
AUTO : ADJOINT when np > NP2NF * nf, else FORWARD (default)
|
|
2201
|
+
"""
|
|
2202
|
+
ADJOINT: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2203
|
+
AUTO: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2204
|
+
FORWARD: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2205
|
+
__members__: typing.ClassVar[dict[str, FFODESLV.GRADIENT_TYPE]]
|
|
2206
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2207
|
+
...
|
|
2208
|
+
def __getstate__(self) -> int:
|
|
2209
|
+
...
|
|
2210
|
+
def __hash__(self) -> int:
|
|
2211
|
+
...
|
|
2212
|
+
def __index__(self) -> int:
|
|
2213
|
+
...
|
|
2214
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2215
|
+
...
|
|
2216
|
+
def __int__(self) -> int:
|
|
2217
|
+
...
|
|
2218
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2219
|
+
...
|
|
2220
|
+
def __repr__(self) -> str:
|
|
2221
|
+
...
|
|
2222
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2223
|
+
...
|
|
2224
|
+
def __str__(self) -> str:
|
|
2225
|
+
...
|
|
2226
|
+
@property
|
|
2227
|
+
def name(self) -> str:
|
|
2228
|
+
...
|
|
2229
|
+
@property
|
|
2230
|
+
def value(self) -> int:
|
|
2231
|
+
...
|
|
2232
|
+
class Options:
|
|
2233
|
+
"""
|
|
2234
|
+
Options of FFODESLV and FFGradODESLV, shared by all operations (class-level:
|
|
2235
|
+
``FFODESLV.options``).
|
|
2236
|
+
"""
|
|
2237
|
+
@property
|
|
2238
|
+
def GRADIENT(self) -> int:
|
|
2239
|
+
"""
|
|
2240
|
+
Sensitivity mode: FFODESLV.FORWARD, ADJOINT or AUTO.
|
|
2241
|
+
"""
|
|
2242
|
+
@GRADIENT.setter
|
|
2243
|
+
def GRADIENT(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2244
|
+
...
|
|
2245
|
+
@property
|
|
2246
|
+
def NP2NF(self) -> float:
|
|
2247
|
+
"""
|
|
2248
|
+
Parameter-to-output ratio above which AUTO uses adjoint sensitivities.
|
|
2249
|
+
"""
|
|
2250
|
+
@NP2NF.setter
|
|
2251
|
+
def NP2NF(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2252
|
+
...
|
|
2253
|
+
@property
|
|
2254
|
+
def SYMDIFF(self) -> list[pymcpp.FFVar]:
|
|
2255
|
+
"""
|
|
2256
|
+
Inputs or constants of the operation differentiated SYMBOLICALLY; the others
|
|
2257
|
+
numerically (sensitivities).
|
|
2258
|
+
"""
|
|
2259
|
+
@SYMDIFF.setter
|
|
2260
|
+
def SYMDIFF(self, arg0: collections.abc.Sequence[pymcpp.FFVar]) -> None:
|
|
2261
|
+
...
|
|
2262
|
+
ADJOINT: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2263
|
+
AUTO: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2264
|
+
COPY: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2265
|
+
FORWARD: typing.ClassVar[FFODESLV.GRADIENT_TYPE]
|
|
2266
|
+
SHALLOW: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2267
|
+
TRANSFER: typing.ClassVar[FFODESLV.POLICY_TYPE]
|
|
2268
|
+
options: typing.ClassVar[FFODESLV.Options]
|
|
2269
|
+
"""
|
|
2270
|
+
Options shared by every FFODESLV and FFGradODESLV operation.
|
|
2271
|
+
"""
|
|
2272
|
+
@typing.overload
|
|
2273
|
+
def __call__(self, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], rest: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: ODESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
2274
|
+
"""
|
|
2275
|
+
TWO-MAP form: the outputs of the solve.
|
|
2276
|
+
|
|
2277
|
+
Parameters
|
|
2278
|
+
----------
|
|
2279
|
+
diff : dict
|
|
2280
|
+
Map 1: the inputs the numerical gradient is taken with respect to, in the
|
|
2281
|
+
order of the gradient columns. Each maps to its DOFs as DAG variables: a
|
|
2282
|
+
list in ``control_dofs`` order, or a generator ``gen(dof) -> FFVar``. It
|
|
2283
|
+
resets the solver's control registry to exactly these inputs.
|
|
2284
|
+
rest : dict
|
|
2285
|
+
Map 2: every other declared input and every constant (one variable each),
|
|
2286
|
+
whose values pass through the DAG with zero numerical derivative.
|
|
2287
|
+
solver : ODESLV
|
|
2288
|
+
The solver (set up). Under COPY (default) the operation holds its own
|
|
2289
|
+
copy; under SHALLOW it refers to ``solver``, which is then kept alive as
|
|
2290
|
+
long as the DAG.
|
|
2291
|
+
policy : FFODESLV.POLICY_TYPE, optional
|
|
2292
|
+
COPY (default) or SHALLOW.
|
|
2293
|
+
name : str, optional
|
|
2294
|
+
Name of the operation in the DAG.
|
|
2295
|
+
"""
|
|
2296
|
+
@typing.overload
|
|
2297
|
+
def __call__(self, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: ODESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
2298
|
+
"""
|
|
2299
|
+
ONE-MAP form: every declared input is differentiated and the model has no
|
|
2300
|
+
constant (refused, naming what is missing, otherwise). Arguments as the
|
|
2301
|
+
two-map form.
|
|
2302
|
+
"""
|
|
2303
|
+
@typing.overload
|
|
2304
|
+
def __call__(self, idep: typing.SupportsInt | typing.SupportsIndex, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], rest: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: ODESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> pymcpp.FFVar:
|
|
2305
|
+
"""
|
|
2306
|
+
TWO-MAP form, output ``idep`` only.
|
|
2307
|
+
"""
|
|
2308
|
+
@typing.overload
|
|
2309
|
+
def __call__(self, idep: typing.SupportsInt | typing.SupportsIndex, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: ODESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> pymcpp.FFVar:
|
|
2310
|
+
"""
|
|
2311
|
+
ONE-MAP form, output ``idep`` only.
|
|
2312
|
+
"""
|
|
2313
|
+
def __init__(self) -> None:
|
|
2314
|
+
"""
|
|
2315
|
+
Default constructor.
|
|
2316
|
+
"""
|
|
2317
|
+
class FFGradODESLV(pymcpp.FFOp):
|
|
2318
|
+
"""
|
|
2319
|
+
The derivative operation of FFODESLV, created when an FFODESLV output is
|
|
2320
|
+
differentiated (FFGraph ``fdiff`` / ``bdiff``); not constructed directly.
|
|
2321
|
+
"""
|
|
2322
|
+
class OCFESLV(FFModel):
|
|
2323
|
+
"""
|
|
2324
|
+
Solver of an FFModel by orthogonal collocation on finite elements (OCFE), in
|
|
2325
|
+
one monolithic solve or marching along the evolution direction
|
|
2326
|
+
(``options.SOLVE.MARCHING``), with forward (``solve_fsens``) and adjoint
|
|
2327
|
+
(``solve_asens``) sensitivity analysis of the outputs with respect to the
|
|
2328
|
+
registered controls.
|
|
2329
|
+
|
|
2330
|
+
The model is declared through the FFModel methods; ``setup()`` analyses it and
|
|
2331
|
+
builds the collocation system. The unknowns live in NumPy arrays: ``init()``
|
|
2332
|
+
returns the collocation state vector ``var`` (initial guess from the
|
|
2333
|
+
references) and the input vector ``inp``; ``set_input_values`` fills inputs;
|
|
2334
|
+
``solve`` overwrites ``var`` with the solution.
|
|
2335
|
+
|
|
2336
|
+
Example -- the heat equation u_t = u_zz with an output:
|
|
2337
|
+
|
|
2338
|
+
>>> S = OCFESLV(G)
|
|
2339
|
+
>>> ... declare domains, states, equations, outputs ...
|
|
2340
|
+
>>> S.setup()
|
|
2341
|
+
>>> var, inp = S.init()
|
|
2342
|
+
>>> rep = S.solve(var, inp)
|
|
2343
|
+
>>> rep.converged, S.val_functions()
|
|
2344
|
+
"""
|
|
2345
|
+
class SolveReport:
|
|
2346
|
+
"""
|
|
2347
|
+
Outcome of a solve.
|
|
2348
|
+
"""
|
|
2349
|
+
def __bool__(self) -> bool:
|
|
2350
|
+
"""
|
|
2351
|
+
True if converged.
|
|
2352
|
+
"""
|
|
2353
|
+
def __repr__(self) -> str:
|
|
2354
|
+
...
|
|
2355
|
+
@property
|
|
2356
|
+
def converged(self) -> bool:
|
|
2357
|
+
"""
|
|
2358
|
+
max|r| <= options.SOLVE.RES_TOL at return
|
|
2359
|
+
"""
|
|
2360
|
+
@property
|
|
2361
|
+
def final_merit(self) -> float:
|
|
2362
|
+
"""
|
|
2363
|
+
0.5 * ||row-scaled r||^2 at return
|
|
2364
|
+
"""
|
|
2365
|
+
@property
|
|
2366
|
+
def final_residual(self) -> float:
|
|
2367
|
+
"""
|
|
2368
|
+
max|r| at return
|
|
2369
|
+
"""
|
|
2370
|
+
@property
|
|
2371
|
+
def initial_residual(self) -> float:
|
|
2372
|
+
"""
|
|
2373
|
+
max|r| at the supplied guess
|
|
2374
|
+
"""
|
|
2375
|
+
@property
|
|
2376
|
+
def iterations(self) -> int:
|
|
2377
|
+
"""
|
|
2378
|
+
accepted outer iterations
|
|
2379
|
+
"""
|
|
2380
|
+
@property
|
|
2381
|
+
def lm_steps(self) -> int:
|
|
2382
|
+
"""
|
|
2383
|
+
accepted damped-LM steps
|
|
2384
|
+
"""
|
|
2385
|
+
@property
|
|
2386
|
+
def newton_steps(self) -> int:
|
|
2387
|
+
"""
|
|
2388
|
+
accepted undamped-Newton steps
|
|
2389
|
+
"""
|
|
2390
|
+
@property
|
|
2391
|
+
def reused(self) -> bool:
|
|
2392
|
+
"""
|
|
2393
|
+
returned from the SOLVE.REUSE primal cache (no Newton run)
|
|
2394
|
+
"""
|
|
2395
|
+
class Options(FFModel.Options):
|
|
2396
|
+
"""
|
|
2397
|
+
Options of OCFESLV: the model options (FFModel.Options) and the collocation
|
|
2398
|
+
solver options, grouped as INTERFACE, SOLVE, OUTPUT, AUDIT, DETERMINACY,
|
|
2399
|
+
SENSITIVITY, HOMOTOPY and FATAL.
|
|
2400
|
+
"""
|
|
2401
|
+
class InterfaceType:
|
|
2402
|
+
"""
|
|
2403
|
+
the interface-condition type. ONE definition, OCPlan's: ocplan.hpp sits below this header in the include order, and it had carried an identical copy whose comment said it "must stay in sync" with FFModel's. Aliased here, with its enumerators re-exported, so Options::IC_VALUE and OCFESLV::Options::IC_AUTO resolve exactly as before.
|
|
2404
|
+
|
|
2405
|
+
Members:
|
|
2406
|
+
|
|
2407
|
+
IC_VALUE : OCPlan::IC_VALUE
|
|
2408
|
+
|
|
2409
|
+
IC_FLUX : OCPlan::IC_FLUX
|
|
2410
|
+
|
|
2411
|
+
IC_UPWIND : OCPlan::IC_UPWIND
|
|
2412
|
+
|
|
2413
|
+
IC_AUTO : OCPlan::IC_AUTO
|
|
2414
|
+
"""
|
|
2415
|
+
IC_AUTO: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
2416
|
+
IC_FLUX: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
2417
|
+
IC_UPWIND: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
2418
|
+
IC_VALUE: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
2419
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.InterfaceType]]
|
|
2420
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2421
|
+
...
|
|
2422
|
+
def __getstate__(self) -> int:
|
|
2423
|
+
...
|
|
2424
|
+
def __hash__(self) -> int:
|
|
2425
|
+
...
|
|
2426
|
+
def __index__(self) -> int:
|
|
2427
|
+
...
|
|
2428
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2429
|
+
...
|
|
2430
|
+
def __int__(self) -> int:
|
|
2431
|
+
...
|
|
2432
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2433
|
+
...
|
|
2434
|
+
def __repr__(self) -> str:
|
|
2435
|
+
...
|
|
2436
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2437
|
+
...
|
|
2438
|
+
def __str__(self) -> str:
|
|
2439
|
+
...
|
|
2440
|
+
@property
|
|
2441
|
+
def name(self) -> str:
|
|
2442
|
+
...
|
|
2443
|
+
@property
|
|
2444
|
+
def value(self) -> int:
|
|
2445
|
+
...
|
|
2446
|
+
class ImpositionType:
|
|
2447
|
+
"""
|
|
2448
|
+
the imposition type. ONE definition, OCPlan's (ocplan.hpp sits below this header), aliased here with its values re-exported -- as InterfaceType is -- so no static_assert has to keep two copies in step.
|
|
2449
|
+
|
|
2450
|
+
Members:
|
|
2451
|
+
|
|
2452
|
+
IC_WEAK : OCPlan::IMPOSITION_IC_WEAK
|
|
2453
|
+
|
|
2454
|
+
IC_STRONG : OCPlan::IMPOSITION_IC_STRONG
|
|
2455
|
+
|
|
2456
|
+
IC_TRACE : OCPlan::IMPOSITION_IC_TRACE
|
|
2457
|
+
"""
|
|
2458
|
+
IC_STRONG: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
2459
|
+
IC_TRACE: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
2460
|
+
IC_WEAK: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
2461
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.ImpositionType]]
|
|
2462
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2463
|
+
...
|
|
2464
|
+
def __getstate__(self) -> int:
|
|
2465
|
+
...
|
|
2466
|
+
def __hash__(self) -> int:
|
|
2467
|
+
...
|
|
2468
|
+
def __index__(self) -> int:
|
|
2469
|
+
...
|
|
2470
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2471
|
+
...
|
|
2472
|
+
def __int__(self) -> int:
|
|
2473
|
+
...
|
|
2474
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2475
|
+
...
|
|
2476
|
+
def __repr__(self) -> str:
|
|
2477
|
+
...
|
|
2478
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2479
|
+
...
|
|
2480
|
+
def __str__(self) -> str:
|
|
2481
|
+
...
|
|
2482
|
+
@property
|
|
2483
|
+
def name(self) -> str:
|
|
2484
|
+
...
|
|
2485
|
+
@property
|
|
2486
|
+
def value(self) -> int:
|
|
2487
|
+
...
|
|
2488
|
+
class InterfaceDropPolicy:
|
|
2489
|
+
"""
|
|
2490
|
+
What setup() does with interface continuity claims the structural analysis finds redundant -- the values of INTERFACE.DROP_POLICY: drop and verify after the solve, re-derive what verification flags, or keep all.
|
|
2491
|
+
|
|
2492
|
+
Members:
|
|
2493
|
+
|
|
2494
|
+
DROP_VERIFY : structural drop + post-solve verify gate (default)
|
|
2495
|
+
|
|
2496
|
+
DROP_REDERIVE : verify-driven re-derive: protect over-dropped claims, re-solve
|
|
2497
|
+
|
|
2498
|
+
DROP_OFF : disable the drop; keep all continuity claims explicit
|
|
2499
|
+
"""
|
|
2500
|
+
DROP_OFF: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
2501
|
+
DROP_REDERIVE: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
2502
|
+
DROP_VERIFY: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
2503
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.InterfaceDropPolicy]]
|
|
2504
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2505
|
+
...
|
|
2506
|
+
def __getstate__(self) -> int:
|
|
2507
|
+
...
|
|
2508
|
+
def __hash__(self) -> int:
|
|
2509
|
+
...
|
|
2510
|
+
def __index__(self) -> int:
|
|
2511
|
+
...
|
|
2512
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2513
|
+
...
|
|
2514
|
+
def __int__(self) -> int:
|
|
2515
|
+
...
|
|
2516
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2517
|
+
...
|
|
2518
|
+
def __repr__(self) -> str:
|
|
2519
|
+
...
|
|
2520
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2521
|
+
...
|
|
2522
|
+
def __str__(self) -> str:
|
|
2523
|
+
...
|
|
2524
|
+
@property
|
|
2525
|
+
def name(self) -> str:
|
|
2526
|
+
...
|
|
2527
|
+
@property
|
|
2528
|
+
def value(self) -> int:
|
|
2529
|
+
...
|
|
2530
|
+
class DerivCacheType:
|
|
2531
|
+
"""
|
|
2532
|
+
undocumented
|
|
2533
|
+
|
|
2534
|
+
Members:
|
|
2535
|
+
|
|
2536
|
+
DERIV_LAZY : DERIV_LAZY
|
|
2537
|
+
|
|
2538
|
+
DERIV_EAGER : DERIV_EAGER
|
|
2539
|
+
"""
|
|
2540
|
+
DERIV_EAGER: typing.ClassVar[OCFESLV.Options.DerivCacheType]
|
|
2541
|
+
DERIV_LAZY: typing.ClassVar[OCFESLV.Options.DerivCacheType]
|
|
2542
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.DerivCacheType]]
|
|
2543
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2544
|
+
...
|
|
2545
|
+
def __getstate__(self) -> int:
|
|
2546
|
+
...
|
|
2547
|
+
def __hash__(self) -> int:
|
|
2548
|
+
...
|
|
2549
|
+
def __index__(self) -> int:
|
|
2550
|
+
...
|
|
2551
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2552
|
+
...
|
|
2553
|
+
def __int__(self) -> int:
|
|
2554
|
+
...
|
|
2555
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2556
|
+
...
|
|
2557
|
+
def __repr__(self) -> str:
|
|
2558
|
+
...
|
|
2559
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2560
|
+
...
|
|
2561
|
+
def __str__(self) -> str:
|
|
2562
|
+
...
|
|
2563
|
+
@property
|
|
2564
|
+
def name(self) -> str:
|
|
2565
|
+
...
|
|
2566
|
+
@property
|
|
2567
|
+
def value(self) -> int:
|
|
2568
|
+
...
|
|
2569
|
+
class LinearEvalCacheType:
|
|
2570
|
+
"""
|
|
2571
|
+
undocumented
|
|
2572
|
+
|
|
2573
|
+
Members:
|
|
2574
|
+
|
|
2575
|
+
LINEAR_NONE : LINEAR_NONE
|
|
2576
|
+
|
|
2577
|
+
LINEAR_LAZY : LINEAR_LAZY
|
|
2578
|
+
|
|
2579
|
+
LINEAR_EAGER : LINEAR_EAGER
|
|
2580
|
+
"""
|
|
2581
|
+
LINEAR_EAGER: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
2582
|
+
LINEAR_LAZY: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
2583
|
+
LINEAR_NONE: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
2584
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.LinearEvalCacheType]]
|
|
2585
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2586
|
+
...
|
|
2587
|
+
def __getstate__(self) -> int:
|
|
2588
|
+
...
|
|
2589
|
+
def __hash__(self) -> int:
|
|
2590
|
+
...
|
|
2591
|
+
def __index__(self) -> int:
|
|
2592
|
+
...
|
|
2593
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2594
|
+
...
|
|
2595
|
+
def __int__(self) -> int:
|
|
2596
|
+
...
|
|
2597
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2598
|
+
...
|
|
2599
|
+
def __repr__(self) -> str:
|
|
2600
|
+
...
|
|
2601
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2602
|
+
...
|
|
2603
|
+
def __str__(self) -> str:
|
|
2604
|
+
...
|
|
2605
|
+
@property
|
|
2606
|
+
def name(self) -> str:
|
|
2607
|
+
...
|
|
2608
|
+
@property
|
|
2609
|
+
def value(self) -> int:
|
|
2610
|
+
...
|
|
2611
|
+
class OutputGridPolicy:
|
|
2612
|
+
"""
|
|
2613
|
+
undocumented
|
|
2614
|
+
|
|
2615
|
+
Members:
|
|
2616
|
+
|
|
2617
|
+
OUT_ELEMENT_LOCAL : OUT_ELEMENT_LOCAL
|
|
2618
|
+
|
|
2619
|
+
OUT_UNIQUE_PHYSICAL : OUT_UNIQUE_PHYSICAL
|
|
2620
|
+
"""
|
|
2621
|
+
OUT_ELEMENT_LOCAL: typing.ClassVar[OCFESLV.Options.OutputGridPolicy]
|
|
2622
|
+
OUT_UNIQUE_PHYSICAL: typing.ClassVar[OCFESLV.Options.OutputGridPolicy]
|
|
2623
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.OutputGridPolicy]]
|
|
2624
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2625
|
+
...
|
|
2626
|
+
def __getstate__(self) -> int:
|
|
2627
|
+
...
|
|
2628
|
+
def __hash__(self) -> int:
|
|
2629
|
+
...
|
|
2630
|
+
def __index__(self) -> int:
|
|
2631
|
+
...
|
|
2632
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2633
|
+
...
|
|
2634
|
+
def __int__(self) -> int:
|
|
2635
|
+
...
|
|
2636
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2637
|
+
...
|
|
2638
|
+
def __repr__(self) -> str:
|
|
2639
|
+
...
|
|
2640
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2641
|
+
...
|
|
2642
|
+
def __str__(self) -> str:
|
|
2643
|
+
...
|
|
2644
|
+
@property
|
|
2645
|
+
def name(self) -> str:
|
|
2646
|
+
...
|
|
2647
|
+
@property
|
|
2648
|
+
def value(self) -> int:
|
|
2649
|
+
...
|
|
2650
|
+
class SolveFactorization:
|
|
2651
|
+
"""
|
|
2652
|
+
Sparse linear factorization backend for the internal LM/Newton solve. SOLVE_SUPERLU uses arma::spsolve with SuperLU (requires the Armadillo build to define ARMA_USE_SUPERLU); when it is not linked the solver transparently falls back to a densifying LAPACK solve (one-time notice). SOLVE_LAPACK forces the densifying dense-LU path (small/debug systems). The enum is left extensible for a future UMFPACK/other direct backend without touching call sites.
|
|
2653
|
+
|
|
2654
|
+
Members:
|
|
2655
|
+
|
|
2656
|
+
SOLVE_SUPERLU : sparse SuperLU (arma::spsolve), default. The solver only ever
|
|
2657
|
+
|
|
2658
|
+
SOLVE_LAPACK : densify the damped operator and use dense LU (debug / small systems)
|
|
2659
|
+
|
|
2660
|
+
SOLVE_SPQR : sparse rank-revealing QR (SuiteSparseQR) min-2-norm least squares on
|
|
2661
|
+
"""
|
|
2662
|
+
SOLVE_LAPACK: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
2663
|
+
SOLVE_SPQR: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
2664
|
+
SOLVE_SUPERLU: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
2665
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.SolveFactorization]]
|
|
2666
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2667
|
+
...
|
|
2668
|
+
def __getstate__(self) -> int:
|
|
2669
|
+
...
|
|
2670
|
+
def __hash__(self) -> int:
|
|
2671
|
+
...
|
|
2672
|
+
def __index__(self) -> int:
|
|
2673
|
+
...
|
|
2674
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2675
|
+
...
|
|
2676
|
+
def __int__(self) -> int:
|
|
2677
|
+
...
|
|
2678
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2679
|
+
...
|
|
2680
|
+
def __repr__(self) -> str:
|
|
2681
|
+
...
|
|
2682
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2683
|
+
...
|
|
2684
|
+
def __str__(self) -> str:
|
|
2685
|
+
...
|
|
2686
|
+
@property
|
|
2687
|
+
def name(self) -> str:
|
|
2688
|
+
...
|
|
2689
|
+
@property
|
|
2690
|
+
def value(self) -> int:
|
|
2691
|
+
...
|
|
2692
|
+
class SolveWarmstart:
|
|
2693
|
+
"""
|
|
2694
|
+
Warm-start strategy for the per-element step of a SOLVE.MARCHING solve.
|
|
2695
|
+
|
|
2696
|
+
Members:
|
|
2697
|
+
|
|
2698
|
+
REUSE : reuse the previous element's converged state as the next guess (free; default)
|
|
2699
|
+
|
|
2700
|
+
BROADCAST_IC : seed every evolution node of the next element with the transferred IC profile
|
|
2701
|
+
|
|
2702
|
+
EXTRAPOLATE : linear/quadratic extrapolation from the last one/two elements' terminals
|
|
2703
|
+
"""
|
|
2704
|
+
BROADCAST_IC: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
2705
|
+
EXTRAPOLATE: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
2706
|
+
REUSE: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
2707
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.SolveWarmstart]]
|
|
2708
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2709
|
+
...
|
|
2710
|
+
def __getstate__(self) -> int:
|
|
2711
|
+
...
|
|
2712
|
+
def __hash__(self) -> int:
|
|
2713
|
+
...
|
|
2714
|
+
def __index__(self) -> int:
|
|
2715
|
+
...
|
|
2716
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2717
|
+
...
|
|
2718
|
+
def __int__(self) -> int:
|
|
2719
|
+
...
|
|
2720
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2721
|
+
...
|
|
2722
|
+
def __repr__(self) -> str:
|
|
2723
|
+
...
|
|
2724
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2725
|
+
...
|
|
2726
|
+
def __str__(self) -> str:
|
|
2727
|
+
...
|
|
2728
|
+
@property
|
|
2729
|
+
def name(self) -> str:
|
|
2730
|
+
...
|
|
2731
|
+
@property
|
|
2732
|
+
def value(self) -> int:
|
|
2733
|
+
...
|
|
2734
|
+
class NT_SKIP_MODE:
|
|
2735
|
+
"""
|
|
2736
|
+
undocumented
|
|
2737
|
+
|
|
2738
|
+
Members:
|
|
2739
|
+
"""
|
|
2740
|
+
__members__: typing.ClassVar[dict] = {}
|
|
2741
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2742
|
+
...
|
|
2743
|
+
def __getstate__(self) -> int:
|
|
2744
|
+
...
|
|
2745
|
+
def __hash__(self) -> int:
|
|
2746
|
+
...
|
|
2747
|
+
def __index__(self) -> int:
|
|
2748
|
+
...
|
|
2749
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2750
|
+
...
|
|
2751
|
+
def __int__(self) -> int:
|
|
2752
|
+
...
|
|
2753
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2754
|
+
...
|
|
2755
|
+
def __repr__(self) -> str:
|
|
2756
|
+
...
|
|
2757
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2758
|
+
...
|
|
2759
|
+
def __str__(self) -> str:
|
|
2760
|
+
...
|
|
2761
|
+
@property
|
|
2762
|
+
def name(self) -> str:
|
|
2763
|
+
...
|
|
2764
|
+
@property
|
|
2765
|
+
def value(self) -> int:
|
|
2766
|
+
...
|
|
2767
|
+
class DETERMINACY_BACKEND_T:
|
|
2768
|
+
"""
|
|
2769
|
+
Rank backend of the determinacy audit (2026-10-09: one value per line, so that the Python binder registers them -- the one-line form left the enum empty in Python).
|
|
2770
|
+
|
|
2771
|
+
Members:
|
|
2772
|
+
|
|
2773
|
+
DET_AUTO : SuiteSparseQR if built, else Eigen if built, else dense under the cap (default)
|
|
2774
|
+
|
|
2775
|
+
DET_SPQR : SuiteSparseQR only; refused by setup() in a build without it (BACKEND_UNAVAILABLE)
|
|
2776
|
+
|
|
2777
|
+
DET_EIGEN : Eigen's sparse QR only; refused by setup() in a build without Eigen (BACKEND_UNAVAILABLE)
|
|
2778
|
+
|
|
2779
|
+
DET_DENSE : dense SVD only, under the size cap
|
|
2780
|
+
"""
|
|
2781
|
+
DET_AUTO: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
2782
|
+
DET_DENSE: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
2783
|
+
DET_EIGEN: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
2784
|
+
DET_SPQR: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
2785
|
+
__members__: typing.ClassVar[dict[str, OCFESLV.Options.DETERMINACY_BACKEND_T]]
|
|
2786
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
2787
|
+
...
|
|
2788
|
+
def __getstate__(self) -> int:
|
|
2789
|
+
...
|
|
2790
|
+
def __hash__(self) -> int:
|
|
2791
|
+
...
|
|
2792
|
+
def __index__(self) -> int:
|
|
2793
|
+
...
|
|
2794
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2795
|
+
...
|
|
2796
|
+
def __int__(self) -> int:
|
|
2797
|
+
...
|
|
2798
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
2799
|
+
...
|
|
2800
|
+
def __repr__(self) -> str:
|
|
2801
|
+
...
|
|
2802
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2803
|
+
...
|
|
2804
|
+
def __str__(self) -> str:
|
|
2805
|
+
...
|
|
2806
|
+
@property
|
|
2807
|
+
def name(self) -> str:
|
|
2808
|
+
...
|
|
2809
|
+
@property
|
|
2810
|
+
def value(self) -> int:
|
|
2811
|
+
...
|
|
2812
|
+
class t_Interface:
|
|
2813
|
+
"""
|
|
2814
|
+
How continuity between elements is expressed and imposed: the condition type, the imposition (penalty, trace multiplier, strong), SAT penalties and trace-multiplier scaling.
|
|
2815
|
+
"""
|
|
2816
|
+
def __init__(self) -> None:
|
|
2817
|
+
...
|
|
2818
|
+
@property
|
|
2819
|
+
def DROP_POLICY(self) -> OCFESLV.Options.InterfaceDropPolicy:
|
|
2820
|
+
"""
|
|
2821
|
+
Policy for the IC_TRACE/IC_STRONG redundant-continuity drop (item 10). DROP_VERIFY keeps the structural receiver-B drop and treats a post-solve over-drop (verify_interface_drop) as a hard failure. DROP_REDERIVE additionally lets the driver protect the over-dropped claims and re-derive/re-solve until the verify gate is clean (correct on the linear suite, and the safe path for the nonlinear case). DROP_OFF disables the drop entirely (every continuity claim kept explicit) -- the most conservative, always-correct baseline.
|
|
2822
|
+
"""
|
|
2823
|
+
@DROP_POLICY.setter
|
|
2824
|
+
def DROP_POLICY(self, arg0: OCFESLV.Options.InterfaceDropPolicy) -> None:
|
|
2825
|
+
...
|
|
2826
|
+
@property
|
|
2827
|
+
def IMPOSITION(self) -> OCFESLV.Options.ImpositionType:
|
|
2828
|
+
"""
|
|
2829
|
+
Imposition strategy for interface conditions: IC_STRONG (default since 2026-10-06; exact continuity rows), IC_WEAK (penalty terms of strength SAT_SIGMA0) or IC_TRACE (trace multipliers)
|
|
2830
|
+
"""
|
|
2831
|
+
@IMPOSITION.setter
|
|
2832
|
+
def IMPOSITION(self, arg0: OCFESLV.Options.ImpositionType) -> None:
|
|
2833
|
+
...
|
|
2834
|
+
@property
|
|
2835
|
+
def SAT_SIGMA0(self) -> float:
|
|
2836
|
+
"""
|
|
2837
|
+
SAT penalty coefficient for C0 (value) continuity. Effective penalty = INTERFACE.SAT_SIGMA0 * tau_d per direction d. Default 10.0 (since 2026-10-03; 1.0 was below threshold at moderate refinement -- a ~10x worse answer, silently -- and 100 can stall the monolithic Newton solve). Default penalty parameter for direction d: tau_d = (n_node - 1)^2 / w_elem (spectral scaling) scaled by INTERFACE.SAT_SIGMA0 (C0 continuity) or CRONOS_SAT_SIGMA1 (C1). When classify_pde() has been called, the penalty is coupled through the principal symbol: sum_j A_d[k,j] * sigma * tau_d * Delta u_j.
|
|
2838
|
+
"""
|
|
2839
|
+
@SAT_SIGMA0.setter
|
|
2840
|
+
def SAT_SIGMA0(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2841
|
+
...
|
|
2842
|
+
@property
|
|
2843
|
+
def TRACE_PROJ_EPS(self) -> float:
|
|
2844
|
+
"""
|
|
2845
|
+
Multiplier-block regularisation for the trace projection. The k continuity conditions the receiver graph cannot support are enforced through a spring of stiffness 1/eps rather than dropped. Default 1.0.
|
|
2846
|
+
"""
|
|
2847
|
+
@TRACE_PROJ_EPS.setter
|
|
2848
|
+
def TRACE_PROJ_EPS(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2849
|
+
...
|
|
2850
|
+
@property
|
|
2851
|
+
def TRACE_PROJ_MAX(self) -> int:
|
|
2852
|
+
"""
|
|
2853
|
+
Largest n_trace_var for which the trace projector is computed; 0 disables the guard. Default 6000.
|
|
2854
|
+
"""
|
|
2855
|
+
@TRACE_PROJ_MAX.setter
|
|
2856
|
+
def TRACE_PROJ_MAX(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2857
|
+
...
|
|
2858
|
+
@property
|
|
2859
|
+
def TRACE_TAU_SCALE(self) -> float:
|
|
2860
|
+
"""
|
|
2861
|
+
Column scaling for generated IC_TRACE tau variables. Claim-centred multipliers enter receiver rows as INTERFACE.TRACE_TAU_SCALE*lambda. The projected u-solution is unchanged, but a non-unit value can improve conditioning when tau variables are much larger/smaller than state rows.
|
|
2862
|
+
"""
|
|
2863
|
+
@TRACE_TAU_SCALE.setter
|
|
2864
|
+
def TRACE_TAU_SCALE(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2865
|
+
...
|
|
2866
|
+
@property
|
|
2867
|
+
def TYPE(self) -> OCFESLV.Options.InterfaceType:
|
|
2868
|
+
"""
|
|
2869
|
+
Interface condition type for multi-element continuity
|
|
2870
|
+
"""
|
|
2871
|
+
@TYPE.setter
|
|
2872
|
+
def TYPE(self, arg0: OCFESLV.Options.InterfaceType) -> None:
|
|
2873
|
+
...
|
|
2874
|
+
class t_Solve:
|
|
2875
|
+
"""
|
|
2876
|
+
The nonlinear solve: Newton/Levenberg-Marquardt control, linear backend, marching, reuse, evaluation caches, and the solver's own verbosity.
|
|
2877
|
+
"""
|
|
2878
|
+
def __init__(self) -> None:
|
|
2879
|
+
...
|
|
2880
|
+
@property
|
|
2881
|
+
def ARMIJO_C(self) -> float:
|
|
2882
|
+
"""
|
|
2883
|
+
Armijo sufficient-decrease constant (1e-4)
|
|
2884
|
+
"""
|
|
2885
|
+
@ARMIJO_C.setter
|
|
2886
|
+
def ARMIJO_C(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2887
|
+
...
|
|
2888
|
+
@property
|
|
2889
|
+
def DERIV_CACHE(self) -> OCFESLV.Options.DerivCacheType:
|
|
2890
|
+
"""
|
|
2891
|
+
Derivative sparsity/coloring cache policy. DERIV_LAZY postpones FFDep sparsity propagation and coloring until a derivative/sparsity query needs them; DERIV_EAGER preserves the older setup-time behaviour.
|
|
2892
|
+
"""
|
|
2893
|
+
@DERIV_CACHE.setter
|
|
2894
|
+
def DERIV_CACHE(self, arg0: OCFESLV.Options.DerivCacheType) -> None:
|
|
2895
|
+
...
|
|
2896
|
+
@property
|
|
2897
|
+
def DISPLAY_LEVEL(self) -> int:
|
|
2898
|
+
"""
|
|
2899
|
+
Solver-side verbosity, independent of the inherited DISPLAY_LEVEL: the model reports its plan, claims and classification, the solver its iterations, factorisation and marching. The default, -1, follows the model's DISPLAY_LEVEL, resolved each time it is read (so a driver may set DISPLAY_LEVEL after construction); set it in code to make the two differ. Not an environment knob. MAXTHREAD is deliberately not duplicated -- it is a process-global RAII cap.
|
|
2900
|
+
"""
|
|
2901
|
+
@DISPLAY_LEVEL.setter
|
|
2902
|
+
def DISPLAY_LEVEL(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2903
|
+
...
|
|
2904
|
+
@property
|
|
2905
|
+
def EQUILIBRATE(self) -> bool:
|
|
2906
|
+
"""
|
|
2907
|
+
row/col inf-norm equilibration (true)
|
|
2908
|
+
"""
|
|
2909
|
+
@EQUILIBRATE.setter
|
|
2910
|
+
def EQUILIBRATE(self, arg0: bool) -> None:
|
|
2911
|
+
...
|
|
2912
|
+
@property
|
|
2913
|
+
def FACTORIZATION(self) -> OCFESLV.Options.SolveFactorization:
|
|
2914
|
+
"""
|
|
2915
|
+
linear backend (default SOLVE_SUPERLU; see note)
|
|
2916
|
+
"""
|
|
2917
|
+
@FACTORIZATION.setter
|
|
2918
|
+
def FACTORIZATION(self, arg0: OCFESLV.Options.SolveFactorization) -> None:
|
|
2919
|
+
...
|
|
2920
|
+
@property
|
|
2921
|
+
def LAMBDA0(self) -> float:
|
|
2922
|
+
"""
|
|
2923
|
+
initial LM damping (1e-8)
|
|
2924
|
+
"""
|
|
2925
|
+
@LAMBDA0.setter
|
|
2926
|
+
def LAMBDA0(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2927
|
+
...
|
|
2928
|
+
@property
|
|
2929
|
+
def LAMBDA_DROP(self) -> float:
|
|
2930
|
+
"""
|
|
2931
|
+
lambda *= this on an accepted LM step (0.25)
|
|
2932
|
+
"""
|
|
2933
|
+
@LAMBDA_DROP.setter
|
|
2934
|
+
def LAMBDA_DROP(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2935
|
+
...
|
|
2936
|
+
@property
|
|
2937
|
+
def LAMBDA_MIN(self) -> float:
|
|
2938
|
+
"""
|
|
2939
|
+
lambda floor (1e-14)
|
|
2940
|
+
"""
|
|
2941
|
+
@LAMBDA_MIN.setter
|
|
2942
|
+
def LAMBDA_MIN(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2943
|
+
...
|
|
2944
|
+
@property
|
|
2945
|
+
def LAMBDA_RAISE(self) -> float:
|
|
2946
|
+
"""
|
|
2947
|
+
lambda *= this on a failed factorization/step (10.0)
|
|
2948
|
+
"""
|
|
2949
|
+
@LAMBDA_RAISE.setter
|
|
2950
|
+
def LAMBDA_RAISE(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2951
|
+
...
|
|
2952
|
+
@property
|
|
2953
|
+
def LINEAR_EVAL_CACHE(self) -> OCFESLV.Options.LinearEvalCacheType:
|
|
2954
|
+
"""
|
|
2955
|
+
Linear residual cache policy. When enabled, purely linear rows are evaluated by a cached sparse affine map r = A z + b whenever the supplied constants match the setup constants. Nonlinear rows and changing constants fall back to normal OCVar evaluation.
|
|
2956
|
+
"""
|
|
2957
|
+
@LINEAR_EVAL_CACHE.setter
|
|
2958
|
+
def LINEAR_EVAL_CACHE(self, arg0: OCFESLV.Options.LinearEvalCacheType) -> None:
|
|
2959
|
+
...
|
|
2960
|
+
@property
|
|
2961
|
+
def LS_MAX(self) -> int:
|
|
2962
|
+
"""
|
|
2963
|
+
backtracking line-search steps (24)
|
|
2964
|
+
"""
|
|
2965
|
+
@LS_MAX.setter
|
|
2966
|
+
def LS_MAX(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2967
|
+
...
|
|
2968
|
+
@property
|
|
2969
|
+
def MARCHING(self) -> bool:
|
|
2970
|
+
"""
|
|
2971
|
+
auto-march when AVAILABLE (evolution domain + >=1 differential state); else monolithic (default true)
|
|
2972
|
+
"""
|
|
2973
|
+
@MARCHING.setter
|
|
2974
|
+
def MARCHING(self, arg0: bool) -> None:
|
|
2975
|
+
...
|
|
2976
|
+
@property
|
|
2977
|
+
def MAX_ITER(self) -> int:
|
|
2978
|
+
"""
|
|
2979
|
+
@name Internal nonlinear-solve (LM/Newton) controls — see OCFESLV::solve(). Defaults reproduce the legacy driver harness numerics. @{ max LM/Newton iterations (30)
|
|
2980
|
+
"""
|
|
2981
|
+
@MAX_ITER.setter
|
|
2982
|
+
def MAX_ITER(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
2983
|
+
...
|
|
2984
|
+
@property
|
|
2985
|
+
def RES_TOL(self) -> float:
|
|
2986
|
+
"""
|
|
2987
|
+
accept on max|r| (1e-9)
|
|
2988
|
+
"""
|
|
2989
|
+
@RES_TOL.setter
|
|
2990
|
+
def RES_TOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
2991
|
+
...
|
|
2992
|
+
@property
|
|
2993
|
+
def REUSE(self) -> bool:
|
|
2994
|
+
"""
|
|
2995
|
+
reuse last converged monolithic solution at the same input (default true)
|
|
2996
|
+
"""
|
|
2997
|
+
@REUSE.setter
|
|
2998
|
+
def REUSE(self, arg0: bool) -> None:
|
|
2999
|
+
...
|
|
3000
|
+
@property
|
|
3001
|
+
def VERBOSE(self) -> bool:
|
|
3002
|
+
"""
|
|
3003
|
+
per-iteration LM/Newton trace to stdout (true)
|
|
3004
|
+
"""
|
|
3005
|
+
@VERBOSE.setter
|
|
3006
|
+
def VERBOSE(self, arg0: bool) -> None:
|
|
3007
|
+
...
|
|
3008
|
+
@property
|
|
3009
|
+
def WARMSTART(self) -> OCFESLV.Options.SolveWarmstart:
|
|
3010
|
+
"""
|
|
3011
|
+
per-element warm-start strategy for a SOLVE.MARCHING solve (default REUSE)
|
|
3012
|
+
"""
|
|
3013
|
+
@WARMSTART.setter
|
|
3014
|
+
def WARMSTART(self, arg0: OCFESLV.Options.SolveWarmstart) -> None:
|
|
3015
|
+
...
|
|
3016
|
+
class t_Output:
|
|
3017
|
+
"""
|
|
3018
|
+
What the solver retains and emits after a solve.
|
|
3019
|
+
"""
|
|
3020
|
+
def __init__(self) -> None:
|
|
3021
|
+
...
|
|
3022
|
+
@property
|
|
3023
|
+
def GRID_POLICY(self) -> OCFESLV.Options.OutputGridPolicy:
|
|
3024
|
+
"""
|
|
3025
|
+
Grid policy for distributed post-evaluation outputs only. OUT_ELEMENT_LOCAL keeps one output row per element-local collocation coefficient, including duplicate physical interface points for LGL/CGL. OUT_UNIQUE_PHYSICAL skips the duplicate left trace of every non-first LGL/CGL element in distributed output dimensions. Equations, states, node_colloc(), interface/SAT handling and scalar point outputs remain element-local.
|
|
3026
|
+
"""
|
|
3027
|
+
@GRID_POLICY.setter
|
|
3028
|
+
def GRID_POLICY(self, arg0: OCFESLV.Options.OutputGridPolicy) -> None:
|
|
3029
|
+
...
|
|
3030
|
+
@property
|
|
3031
|
+
def MARCH_STORE(self) -> bool:
|
|
3032
|
+
"""
|
|
3033
|
+
SOLVE.MARCHING: keep each element's block solution (O(N)) for plotting/inspection via march_trajectory()/eval_solution() (default true)
|
|
3034
|
+
"""
|
|
3035
|
+
@MARCH_STORE.setter
|
|
3036
|
+
def MARCH_STORE(self, arg0: bool) -> None:
|
|
3037
|
+
...
|
|
3038
|
+
class t_Audit:
|
|
3039
|
+
"""
|
|
3040
|
+
Reports that diagnose the user's MODEL. They change what is printed, never the result.
|
|
3041
|
+
"""
|
|
3042
|
+
def __init__(self) -> None:
|
|
3043
|
+
...
|
|
3044
|
+
@property
|
|
3045
|
+
def COVERAGE(self) -> bool:
|
|
3046
|
+
"""
|
|
3047
|
+
print the structural column-coverage report and the claim census at the end of setup() (false). Setup-time only: no solve, no SVD. A state column covered by NO row is a free degree of freedom; singly-covered columns are the fragility margin. Necessary, not sufficient -- see the method doc. Environment default: CRONOS_AUDIT_COVERAGE, else CRONOS_AUDIT.
|
|
3048
|
+
"""
|
|
3049
|
+
@COVERAGE.setter
|
|
3050
|
+
def COVERAGE(self, arg0: bool) -> None:
|
|
3051
|
+
...
|
|
3052
|
+
@property
|
|
3053
|
+
def EQN_LEGEND(self) -> bool:
|
|
3054
|
+
"""
|
|
3055
|
+
print the eN -> equation legend (roles, bare states, partial orders per direction) at the end of setup() (false). Printed unconditionally at the head of a spectrum audit regardless of this flag. The legend is what makes an audit's "by eqn eN" resolvable against the model, and its `partials` column identifies the assembled formulation independently of any banner. Environment default: CRONOS_AUDIT_LEGEND, else CRONOS_AUDIT.
|
|
3056
|
+
"""
|
|
3057
|
+
@EQN_LEGEND.setter
|
|
3058
|
+
def EQN_LEGEND(self, arg0: bool) -> None:
|
|
3059
|
+
...
|
|
3060
|
+
@property
|
|
3061
|
+
def RANK_SYMMETRY(self) -> bool:
|
|
3062
|
+
"""
|
|
3063
|
+
print the saddle-point rank-symmetry report at the end of setup(): rank of the multiplier column block B against rank of the continuity row block C. rank(B) < n_trace_var makes the augmented system singular for ANY C and cannot be repaired by dropping or pinning rows. Environment default: CRONOS_AUDIT_RANK, else CRONOS_AUDIT.
|
|
3064
|
+
"""
|
|
3065
|
+
@RANK_SYMMETRY.setter
|
|
3066
|
+
def RANK_SYMMETRY(self, arg0: bool) -> None:
|
|
3067
|
+
...
|
|
3068
|
+
@property
|
|
3069
|
+
def SPECTRUM(self) -> bool:
|
|
3070
|
+
"""
|
|
3071
|
+
run the singular-value / left+right null-space audit at iteration 0 of every solve(), not only when tier-0 Newton is found singular (false). Needed to compare a CONVERGING run against a failing one: the historical trigger fired only on failure, so a wrong-but-converged solve was never audited. Environment default: CRONOS_AUDIT_SPECTRUM (NOT implied by CRONOS_AUDIT).
|
|
3072
|
+
"""
|
|
3073
|
+
@SPECTRUM.setter
|
|
3074
|
+
def SPECTRUM(self, arg0: bool) -> None:
|
|
3075
|
+
...
|
|
3076
|
+
@property
|
|
3077
|
+
def SPECTRUM_MAX(self) -> int:
|
|
3078
|
+
"""
|
|
3079
|
+
largest dense-SVD the spectrum audit will attempt, in either dimension. Was a hard literal 3000, which put `rel` out of reach on exactly the configurations where the question lives (MMPDE13 at production order reaches the limit by NEL_T=4). Cost is O(n^3): 3000 is seconds, 6000 a few minutes. Environment: CRONOS_SPECTRUM_MAX.
|
|
3080
|
+
"""
|
|
3081
|
+
@SPECTRUM_MAX.setter
|
|
3082
|
+
def SPECTRUM_MAX(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3083
|
+
...
|
|
3084
|
+
class t_Determinacy:
|
|
3085
|
+
"""
|
|
3086
|
+
The numerical-rank determinacy audit run at the end of setup().
|
|
3087
|
+
"""
|
|
3088
|
+
def __init__(self) -> None:
|
|
3089
|
+
...
|
|
3090
|
+
@property
|
|
3091
|
+
def AUDIT(self) -> bool:
|
|
3092
|
+
"""
|
|
3093
|
+
run the numerical-rank determinacy audit at the end of setup() (false). One report line per audited window, unconditional on DISPLAY_LEVEL. Environment: CRONOS_AUDIT_DETERMINACY.
|
|
3094
|
+
"""
|
|
3095
|
+
@AUDIT.setter
|
|
3096
|
+
def AUDIT(self, arg0: bool) -> None:
|
|
3097
|
+
...
|
|
3098
|
+
@property
|
|
3099
|
+
def BACKEND(self) -> OCFESLV.Options.DETERMINACY_BACKEND_T:
|
|
3100
|
+
"""
|
|
3101
|
+
rank backend: DET_AUTO = SPQR if built, else Eigen if built, else dense under the cap. Values: AUTO|SPQR|EIGEN|DENSE. An explicit DET_SPQR / DET_EIGEN in a build without that backend is REFUSED by setup() (BACKEND_UNAVAILABLE) -- it used to skip the check silently.
|
|
3102
|
+
"""
|
|
3103
|
+
@BACKEND.setter
|
|
3104
|
+
def BACKEND(self, arg0: OCFESLV.Options.DETERMINACY_BACKEND_T) -> None:
|
|
3105
|
+
...
|
|
3106
|
+
@property
|
|
3107
|
+
def TOL(self) -> float:
|
|
3108
|
+
"""
|
|
3109
|
+
the SINGLE relative rank tolerance, applied identically to rank(M) and rank([B;D]) (1e-12; the value the spectrum audit's rank_deficiency[] uses).
|
|
3110
|
+
"""
|
|
3111
|
+
@TOL.setter
|
|
3112
|
+
def TOL(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3113
|
+
...
|
|
3114
|
+
class t_Sensitivity:
|
|
3115
|
+
"""
|
|
3116
|
+
The linear solve inside the forward/adjoint sensitivity computation.
|
|
3117
|
+
"""
|
|
3118
|
+
def __init__(self) -> None:
|
|
3119
|
+
...
|
|
3120
|
+
@property
|
|
3121
|
+
def SPARSE(self) -> bool:
|
|
3122
|
+
"""
|
|
3123
|
+
assemble the sensitivity Jacobian SPARSELY and solve with arma::spsolve (SuperLU) instead of a dense arma::mat + arma::lu. WHY. The dense Jacobian is ~2.6 GB at 18202^2 and O(n^3) to factorise -- a scalability wall INDEPENDENT of the singularity question, and one that affects IC_WEAK fixed-mesh models too. It has simply not bitten yet because every fsens/asens driver in the corpus is small. The primal path has been sparse throughout. WHAT IT DOES NOT DO. Sparse LU is still LU. It does NOT make the interface-augmented systems that fail today succeed -- it reports the same singularity, though it fails cleanly (SuperLU throws) instead of falling into a dense approximate solve that does not terminate usefully. That is better DIAGNOSABILITY, not better capability. Reliability is tier 1 (SPQR). This is TIER 0 of the eventual design, mirroring the primal: SuperLU normally, rank-revealing QR when nTrace > 0. Default ON; set false for the dense path.
|
|
3124
|
+
"""
|
|
3125
|
+
@SPARSE.setter
|
|
3126
|
+
def SPARSE(self, arg0: bool) -> None:
|
|
3127
|
+
...
|
|
3128
|
+
class t_Homotopy:
|
|
3129
|
+
"""
|
|
3130
|
+
Continuation in the parameters registered with add_homotopy().
|
|
3131
|
+
"""
|
|
3132
|
+
def __init__(self) -> None:
|
|
3133
|
+
...
|
|
3134
|
+
@property
|
|
3135
|
+
def AUTO_DESTAGE(self) -> bool:
|
|
3136
|
+
"""
|
|
3137
|
+
when a multi-parameter stage fails, split it into sequential single-parameter sub-stages from the point it reached, rather than giving up (true). Announced LOUDLY on stderr and recorded in StageReport::destaged: needing it usually says something about the MODEL -- those parameters interact too strongly to move together -- so it should be noticed, not silently absorbed.
|
|
3138
|
+
"""
|
|
3139
|
+
@AUTO_DESTAGE.setter
|
|
3140
|
+
def AUTO_DESTAGE(self, arg0: bool) -> None:
|
|
3141
|
+
...
|
|
3142
|
+
@property
|
|
3143
|
+
def ENABLE(self) -> bool:
|
|
3144
|
+
"""
|
|
3145
|
+
honour homotopy parameters registered with add_homotopy() (true). When false the schedule is IGNORED and solve() runs directly at the current input values -- useful for with/without contrast runs without unregistering the model's parameters.
|
|
3146
|
+
"""
|
|
3147
|
+
@ENABLE.setter
|
|
3148
|
+
def ENABLE(self, arg0: bool) -> None:
|
|
3149
|
+
...
|
|
3150
|
+
@property
|
|
3151
|
+
def PREDICT(self) -> bool:
|
|
3152
|
+
"""
|
|
3153
|
+
guarded extrapolation predictor (true)
|
|
3154
|
+
"""
|
|
3155
|
+
@PREDICT.setter
|
|
3156
|
+
def PREDICT(self, arg0: bool) -> None:
|
|
3157
|
+
...
|
|
3158
|
+
@property
|
|
3159
|
+
def PREDICT_ORDER(self) -> int:
|
|
3160
|
+
"""
|
|
3161
|
+
max order of the extrapolation from accepted points (2). 0 = plain reuse, 1 = secant (2 points), 2 = quadratic (3 points). Every candidate up to this order is TRIED and the smallest-residual one is kept, so raising it can only help: a worse extrapolation is discarded for the price of one residual evaluation. NOTE a TANGENT predictor is deliberately ABSENT. It is redundant with the corrector's first Newton step: at a converged x(s) with the parameters moved to s+ds, r(x,p(s+ds)) ~ ds*dr/ds, so the first Newton step is -J^-1 r ~ ds*dx/ds -- the tangent itself. Computing it explicitly would cost a Jacobian and a factorization to save the very iteration that produces it. Extrapolation from already-accepted points needs neither.
|
|
3162
|
+
"""
|
|
3163
|
+
@PREDICT_ORDER.setter
|
|
3164
|
+
def PREDICT_ORDER(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3165
|
+
...
|
|
3166
|
+
@property
|
|
3167
|
+
def STEP_CAP(self) -> float:
|
|
3168
|
+
"""
|
|
3169
|
+
max homotopy step in s, and the step the ramp STARTS at (0.1). PATH FIDELITY KNOB, and the one that matters: a converged step is NOT evidence of correctness -- too large a cap can move the corrector onto a different solution branch with no warning.
|
|
3170
|
+
"""
|
|
3171
|
+
@STEP_CAP.setter
|
|
3172
|
+
def STEP_CAP(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3173
|
+
...
|
|
3174
|
+
@property
|
|
3175
|
+
def STEP_GROW(self) -> float:
|
|
3176
|
+
"""
|
|
3177
|
+
step growth after an accepted step (1.4). Only acts as the RECOVERY rate after a backtrack, since the ramp starts at the cap.
|
|
3178
|
+
"""
|
|
3179
|
+
@STEP_GROW.setter
|
|
3180
|
+
def STEP_GROW(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3181
|
+
...
|
|
3182
|
+
@property
|
|
3183
|
+
def STEP_MIN(self) -> float:
|
|
3184
|
+
"""
|
|
3185
|
+
abandon stage below this step (1e-5)
|
|
3186
|
+
"""
|
|
3187
|
+
@STEP_MIN.setter
|
|
3188
|
+
def STEP_MIN(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3189
|
+
...
|
|
3190
|
+
@property
|
|
3191
|
+
def STEP_SHRINK(self) -> float:
|
|
3192
|
+
"""
|
|
3193
|
+
step shrink after a failed step (0.5). *** REQUIRED: HOMOTOPY.STEP_GROW * HOMOTOPY.STEP_SHRINK < 1. *** Otherwise a step near the critical size alternates fail/succeed forever (shrink then grow returns it above the failing value), wasting one solve per accepted step. The asymmetry -- shrink fast, grow slowly -- is what makes the step ratchet down and settle.
|
|
3194
|
+
"""
|
|
3195
|
+
@STEP_SHRINK.setter
|
|
3196
|
+
def STEP_SHRINK(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3197
|
+
...
|
|
3198
|
+
class t_Fatal:
|
|
3199
|
+
"""
|
|
3200
|
+
Which conditions make setup() FAIL rather than warn.
|
|
3201
|
+
"""
|
|
3202
|
+
def __init__(self) -> None:
|
|
3203
|
+
...
|
|
3204
|
+
@property
|
|
3205
|
+
def DETERMINACY(self) -> bool:
|
|
3206
|
+
"""
|
|
3207
|
+
setup() returns false (SetupStatus::DETERMINACY_UNDETERMINED) on a STATE CONTENT verdict (false).
|
|
3208
|
+
"""
|
|
3209
|
+
@DETERMINACY.setter
|
|
3210
|
+
def DETERMINACY(self, arg0: bool) -> None:
|
|
3211
|
+
...
|
|
3212
|
+
@property
|
|
3213
|
+
def EVOLUTION_DOMAIN(self) -> bool:
|
|
3214
|
+
"""
|
|
3215
|
+
setup() returns false on an unsuitable evolution domain or an IC that cannot be set consistently (true); false (default) downgrades to a DISPLAY_LEVEL warning and proceeds
|
|
3216
|
+
"""
|
|
3217
|
+
@EVOLUTION_DOMAIN.setter
|
|
3218
|
+
def EVOLUTION_DOMAIN(self, arg0: bool) -> None:
|
|
3219
|
+
...
|
|
3220
|
+
@property
|
|
3221
|
+
def INTERFACE_RANK(self) -> bool:
|
|
3222
|
+
"""
|
|
3223
|
+
setup() returns false (INTERFACE_PLAN_INVALID) when the multiplier block B is column rank-deficient. Default FALSE: the resulting kernel is singular but not always fatal (a model whose residual satisfies the compatibility conditions still converges), so this stays opt-in until the corpus has been re-baselined.
|
|
3224
|
+
"""
|
|
3225
|
+
@INTERFACE_RANK.setter
|
|
3226
|
+
def INTERFACE_RANK(self, arg0: bool) -> None:
|
|
3227
|
+
...
|
|
3228
|
+
@property
|
|
3229
|
+
def REDUCED_DOF(self) -> bool:
|
|
3230
|
+
"""
|
|
3231
|
+
setup() returns false on a structurally IC/BC-inconsistent reduced system (true); false downgrades to a warning and proceeds (rank-revealing solve)
|
|
3232
|
+
"""
|
|
3233
|
+
@REDUCED_DOF.setter
|
|
3234
|
+
def REDUCED_DOF(self, arg0: bool) -> None:
|
|
3235
|
+
...
|
|
3236
|
+
BROADCAST_IC: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
3237
|
+
DERIV_EAGER: typing.ClassVar[OCFESLV.Options.DerivCacheType]
|
|
3238
|
+
DERIV_LAZY: typing.ClassVar[OCFESLV.Options.DerivCacheType]
|
|
3239
|
+
DET_AUTO: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
3240
|
+
DET_DENSE: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
3241
|
+
DET_EIGEN: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
3242
|
+
DET_SPQR: typing.ClassVar[OCFESLV.Options.DETERMINACY_BACKEND_T]
|
|
3243
|
+
DROP_OFF: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
3244
|
+
DROP_REDERIVE: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
3245
|
+
DROP_VERIFY: typing.ClassVar[OCFESLV.Options.InterfaceDropPolicy]
|
|
3246
|
+
EXTRAPOLATE: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
3247
|
+
IC_AUTO: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
3248
|
+
IC_FLUX: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
3249
|
+
IC_STRONG: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
3250
|
+
IC_TRACE: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
3251
|
+
IC_UPWIND: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
3252
|
+
IC_VALUE: typing.ClassVar[OCFESLV.Options.InterfaceType]
|
|
3253
|
+
IC_WEAK: typing.ClassVar[OCFESLV.Options.ImpositionType]
|
|
3254
|
+
LINEAR_EAGER: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
3255
|
+
LINEAR_LAZY: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
3256
|
+
LINEAR_NONE: typing.ClassVar[OCFESLV.Options.LinearEvalCacheType]
|
|
3257
|
+
OUT_ELEMENT_LOCAL: typing.ClassVar[OCFESLV.Options.OutputGridPolicy]
|
|
3258
|
+
OUT_UNIQUE_PHYSICAL: typing.ClassVar[OCFESLV.Options.OutputGridPolicy]
|
|
3259
|
+
REUSE: typing.ClassVar[OCFESLV.Options.SolveWarmstart]
|
|
3260
|
+
SOLVE_LAPACK: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
3261
|
+
SOLVE_SPQR: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
3262
|
+
SOLVE_SUPERLU: typing.ClassVar[OCFESLV.Options.SolveFactorization]
|
|
3263
|
+
@typing.overload
|
|
3264
|
+
def __init__(self) -> None:
|
|
3265
|
+
...
|
|
3266
|
+
@typing.overload
|
|
3267
|
+
def __init__(self, arg0: OCFESLV.Options) -> None:
|
|
3268
|
+
...
|
|
3269
|
+
@property
|
|
3270
|
+
def AUDIT(self) -> OCFESLV.Options.t_Audit:
|
|
3271
|
+
"""
|
|
3272
|
+
Reports that diagnose the user's MODEL. They change what is printed, never the result.
|
|
3273
|
+
"""
|
|
3274
|
+
@AUDIT.setter
|
|
3275
|
+
def AUDIT(self, arg0: OCFESLV.Options.t_Audit) -> None:
|
|
3276
|
+
...
|
|
3277
|
+
@property
|
|
3278
|
+
def DETERMINACY(self) -> OCFESLV.Options.t_Determinacy:
|
|
3279
|
+
"""
|
|
3280
|
+
The numerical-rank determinacy audit run at the end of setup().
|
|
3281
|
+
"""
|
|
3282
|
+
@DETERMINACY.setter
|
|
3283
|
+
def DETERMINACY(self, arg0: OCFESLV.Options.t_Determinacy) -> None:
|
|
3284
|
+
...
|
|
3285
|
+
@property
|
|
3286
|
+
def FATAL(self) -> OCFESLV.Options.t_Fatal:
|
|
3287
|
+
"""
|
|
3288
|
+
Which conditions make setup() FAIL rather than warn.
|
|
3289
|
+
"""
|
|
3290
|
+
@FATAL.setter
|
|
3291
|
+
def FATAL(self, arg0: OCFESLV.Options.t_Fatal) -> None:
|
|
3292
|
+
...
|
|
3293
|
+
@property
|
|
3294
|
+
def HOMOTOPY(self) -> OCFESLV.Options.t_Homotopy:
|
|
3295
|
+
"""
|
|
3296
|
+
Continuation in the parameters registered with add_homotopy().
|
|
3297
|
+
"""
|
|
3298
|
+
@HOMOTOPY.setter
|
|
3299
|
+
def HOMOTOPY(self, arg0: OCFESLV.Options.t_Homotopy) -> None:
|
|
3300
|
+
...
|
|
3301
|
+
@property
|
|
3302
|
+
def INTERFACE(self) -> OCFESLV.Options.t_Interface:
|
|
3303
|
+
"""
|
|
3304
|
+
How continuity between elements is expressed and imposed: the condition type, the imposition (penalty, trace multiplier, strong), SAT penalties and trace-multiplier scaling.
|
|
3305
|
+
"""
|
|
3306
|
+
@INTERFACE.setter
|
|
3307
|
+
def INTERFACE(self, arg0: OCFESLV.Options.t_Interface) -> None:
|
|
3308
|
+
...
|
|
3309
|
+
@property
|
|
3310
|
+
def OUTPUT(self) -> OCFESLV.Options.t_Output:
|
|
3311
|
+
"""
|
|
3312
|
+
What the solver retains and emits after a solve.
|
|
3313
|
+
"""
|
|
3314
|
+
@OUTPUT.setter
|
|
3315
|
+
def OUTPUT(self, arg0: OCFESLV.Options.t_Output) -> None:
|
|
3316
|
+
...
|
|
3317
|
+
@property
|
|
3318
|
+
def SENSITIVITY(self) -> OCFESLV.Options.t_Sensitivity:
|
|
3319
|
+
"""
|
|
3320
|
+
The linear solve inside the forward/adjoint sensitivity computation.
|
|
3321
|
+
"""
|
|
3322
|
+
@SENSITIVITY.setter
|
|
3323
|
+
def SENSITIVITY(self, arg0: OCFESLV.Options.t_Sensitivity) -> None:
|
|
3324
|
+
...
|
|
3325
|
+
@property
|
|
3326
|
+
def SOLVE(self) -> OCFESLV.Options.t_Solve:
|
|
3327
|
+
"""
|
|
3328
|
+
The nonlinear solve: Newton/Levenberg-Marquardt control, linear backend, marching, reuse, evaluation caches, and the solver's own verbosity.
|
|
3329
|
+
"""
|
|
3330
|
+
@SOLVE.setter
|
|
3331
|
+
def SOLVE(self, arg0: OCFESLV.Options.t_Solve) -> None:
|
|
3332
|
+
...
|
|
3333
|
+
class EqnOptions(FFModel.EqnOptions):
|
|
3334
|
+
"""
|
|
3335
|
+
Options of one equation for OCFESLV: the model options (role, block) and the
|
|
3336
|
+
local interface-condition settings.
|
|
3337
|
+
"""
|
|
3338
|
+
@typing.overload
|
|
3339
|
+
def __init__(self, role: FFModel.EqnRole = ..., block_id: typing.SupportsInt | typing.SupportsIndex = 0, interface_type: OCFESLV.Options.InterfaceType = ...) -> None:
|
|
3340
|
+
"""
|
|
3341
|
+
Options with role-derived defaults.
|
|
3342
|
+
"""
|
|
3343
|
+
@typing.overload
|
|
3344
|
+
def __init__(self, role: FFModel.EqnRole, block_id: typing.SupportsInt | typing.SupportsIndex, interface_type: OCFESLV.Options.InterfaceType, classify: bool, sat: bool, donate: bool = False) -> None:
|
|
3345
|
+
"""
|
|
3346
|
+
Options with explicit flags (the role invariants still apply: an INTERFACE row
|
|
3347
|
+
never enters classification).
|
|
3348
|
+
"""
|
|
3349
|
+
@property
|
|
3350
|
+
def donate_for_state_continuity(self) -> bool:
|
|
3351
|
+
"""
|
|
3352
|
+
may be donated as a duplicate trace row
|
|
3353
|
+
"""
|
|
3354
|
+
@donate_for_state_continuity.setter
|
|
3355
|
+
def donate_for_state_continuity(self, arg0: bool) -> None:
|
|
3356
|
+
...
|
|
3357
|
+
@property
|
|
3358
|
+
def interface_type(self) -> OCFESLV.Options.InterfaceType:
|
|
3359
|
+
"""
|
|
3360
|
+
local interface-condition type (IC_AUTO: resolved)
|
|
3361
|
+
"""
|
|
3362
|
+
@interface_type.setter
|
|
3363
|
+
def interface_type(self, arg0: OCFESLV.Options.InterfaceType) -> None:
|
|
3364
|
+
...
|
|
3365
|
+
@property
|
|
3366
|
+
def receive_sat(self) -> bool:
|
|
3367
|
+
"""
|
|
3368
|
+
may receive weak (SAT) interface penalties
|
|
3369
|
+
"""
|
|
3370
|
+
@receive_sat.setter
|
|
3371
|
+
def receive_sat(self, arg0: bool) -> None:
|
|
3372
|
+
...
|
|
3373
|
+
@staticmethod
|
|
3374
|
+
def revision() -> str:
|
|
3375
|
+
"""
|
|
3376
|
+
The revision of the solver (ocfeslv.hpp). FFModel.revision() gives the model
|
|
3377
|
+
layer's, which a build may combine with another solver revision.
|
|
3378
|
+
"""
|
|
3379
|
+
def __init__(self, dag: pymcpp.FFGraph) -> None:
|
|
3380
|
+
"""
|
|
3381
|
+
Empty solver and model on the DAG ``dag`` (kept alive by it).
|
|
3382
|
+
"""
|
|
3383
|
+
def blk_fct(self, ndx: typing.SupportsInt | typing.SupportsIndex) -> tuple[int, int]:
|
|
3384
|
+
"""
|
|
3385
|
+
The block of output ``ndx`` (in add_output() order) in ``val_functions()``:
|
|
3386
|
+
``(first, count)`` -- one value for a point output, one per selected node for
|
|
3387
|
+
a distributed output.
|
|
3388
|
+
"""
|
|
3389
|
+
def decode_controls(self, p: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], inp: typing.Any) -> None:
|
|
3390
|
+
"""
|
|
3391
|
+
Write the control DOF values ``p`` into ``inp`` (in place).
|
|
3392
|
+
"""
|
|
3393
|
+
def encode_controls(self, inp: typing.Any) -> list[float]:
|
|
3394
|
+
"""
|
|
3395
|
+
The control DOF values held in ``inp``, in the order of the gradient columns.
|
|
3396
|
+
"""
|
|
3397
|
+
def eval_solution(self, state: pymcpp.FFVar, point: collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex]) -> float:
|
|
3398
|
+
"""
|
|
3399
|
+
Value of ``state`` at ``point`` (a dict ``{domain: coordinate}``) in the last
|
|
3400
|
+
converged solution, in EITHER solve mode: the cached primal of a monolithic
|
|
3401
|
+
solve (``options.SOLVE.REUSE``) or the stored windows of a marching solve
|
|
3402
|
+
(``options.OUTPUT.MARCH_STORE``) -- both on by default.
|
|
3403
|
+
"""
|
|
3404
|
+
def get_input_values(self, input: pymcpp.FFVar, inp: typing.Any) -> list[float]:
|
|
3405
|
+
"""
|
|
3406
|
+
The collocated values of input ``input`` in ``inp``.
|
|
3407
|
+
"""
|
|
3408
|
+
def init(self, cst: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | None = None) -> tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]]:
|
|
3409
|
+
"""
|
|
3410
|
+
The collocation vectors after ``setup()``: ``(var, inp)`` as NumPy arrays --
|
|
3411
|
+
``var`` the state coefficients initialised from the references, ``inp`` the
|
|
3412
|
+
input coefficients initialised from the input references.
|
|
3413
|
+
|
|
3414
|
+
Parameters
|
|
3415
|
+
----------
|
|
3416
|
+
cst : list of float, optional
|
|
3417
|
+
Constant values, in the order of ``var_constant``.
|
|
3418
|
+
"""
|
|
3419
|
+
def is_marching(self) -> bool:
|
|
3420
|
+
"""
|
|
3421
|
+
True if the model is solved by marching.
|
|
3422
|
+
"""
|
|
3423
|
+
def march_grid(self) -> list[float]:
|
|
3424
|
+
"""
|
|
3425
|
+
The window boundaries of the march (empty for a monolithic setup).
|
|
3426
|
+
"""
|
|
3427
|
+
def march_trajectory(self) -> list:
|
|
3428
|
+
"""
|
|
3429
|
+
The stored windows of the last marching solve
|
|
3430
|
+
(``options.OUTPUT.MARCH_STORE``): one dict per window with ``t0``, ``t1`` and
|
|
3431
|
+
the window's collocated ``var`` and ``inp`` (NumPy arrays).
|
|
3432
|
+
"""
|
|
3433
|
+
def n_colloc_eqn(self) -> int:
|
|
3434
|
+
"""
|
|
3435
|
+
Number of collocation equation residuals.
|
|
3436
|
+
"""
|
|
3437
|
+
def n_colloc_fct(self) -> int:
|
|
3438
|
+
"""
|
|
3439
|
+
Number of scalar output functions.
|
|
3440
|
+
"""
|
|
3441
|
+
def n_colloc_inp(self) -> int:
|
|
3442
|
+
"""
|
|
3443
|
+
Size of ``inp``: collocation input coefficients.
|
|
3444
|
+
"""
|
|
3445
|
+
def n_colloc_sta(self) -> int:
|
|
3446
|
+
"""
|
|
3447
|
+
Size of ``var``: collocation state coefficients.
|
|
3448
|
+
"""
|
|
3449
|
+
def n_colloc_trace(self) -> int:
|
|
3450
|
+
"""
|
|
3451
|
+
Number of trace variables (0 under IC_STRONG).
|
|
3452
|
+
"""
|
|
3453
|
+
def n_march_steps(self) -> int:
|
|
3454
|
+
"""
|
|
3455
|
+
Number of march steps.
|
|
3456
|
+
"""
|
|
3457
|
+
def node_colloc(self, var: pymcpp.FFVar) -> list[list[float]]:
|
|
3458
|
+
"""
|
|
3459
|
+
The collocation node coordinates of state or input ``var``.
|
|
3460
|
+
"""
|
|
3461
|
+
def sample_input(self, input: pymcpp.FFVar, fun: collections.abc.Callable[[collections.abc.Mapping[pymcpp.FFVar, typing.SupportsFloat | typing.SupportsIndex]], float], inp: typing.Any) -> None:
|
|
3462
|
+
"""
|
|
3463
|
+
Write input ``input`` into ``inp`` (in place) from a function ``fun({domain:
|
|
3464
|
+
coordinate}) -> float`` evaluated at its collocation nodes.
|
|
3465
|
+
"""
|
|
3466
|
+
def sens_functions(self) -> list[float]:
|
|
3467
|
+
"""
|
|
3468
|
+
Output values captured by the last solve_fsens / solve_asens.
|
|
3469
|
+
"""
|
|
3470
|
+
def sens_jacobian(self) -> numpy.typing.NDArray[numpy.float64]:
|
|
3471
|
+
"""
|
|
3472
|
+
Jacobian of the outputs with respect to the control DOFs, captured by the last
|
|
3473
|
+
solve_fsens / solve_asens: NumPy array of shape (nf, n_control_dof), columns
|
|
3474
|
+
in the order of the registered controls and their ``control_dofs``.
|
|
3475
|
+
"""
|
|
3476
|
+
def set_input_values(self, input: pymcpp.FFVar, values: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], inp: typing.Any) -> None:
|
|
3477
|
+
"""
|
|
3478
|
+
Write the collocated values of input ``input`` into ``inp`` (in place):
|
|
3479
|
+
element-major, node-inner, as ``get_input_values`` reads them.
|
|
3480
|
+
"""
|
|
3481
|
+
def solve(self, var: typing.Any, inp: typing.Any = None, cst: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | None = None) -> OCFESLV.SolveReport:
|
|
3482
|
+
"""
|
|
3483
|
+
Solve the collocation system; returns a SolveReport.
|
|
3484
|
+
|
|
3485
|
+
Parameters
|
|
3486
|
+
----------
|
|
3487
|
+
var : numpy.ndarray
|
|
3488
|
+
Collocation state coefficients (float64, size ``n_colloc_sta()``): the
|
|
3489
|
+
initial guess, overwritten IN PLACE with the solution.
|
|
3490
|
+
inp : numpy.ndarray, optional
|
|
3491
|
+
Collocation input coefficients (float64, size ``n_colloc_inp()``), e.g.
|
|
3492
|
+
from ``init`` and ``set_input_values``.
|
|
3493
|
+
cst : list of float, optional
|
|
3494
|
+
Constant values, in the order of ``var_constant``.
|
|
3495
|
+
"""
|
|
3496
|
+
def solve_asens(self, var: typing.Any, inp: typing.Any = None, cst: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | None = None) -> bool:
|
|
3497
|
+
"""
|
|
3498
|
+
Solve, then the adjoint sensitivities of the outputs with respect to the registered controls (``sens_jacobian``); returns True on success.
|
|
3499
|
+
|
|
3500
|
+
Parameters
|
|
3501
|
+
----------
|
|
3502
|
+
var : numpy.ndarray
|
|
3503
|
+
Collocation state coefficients (float64, size ``n_colloc_sta()``): the
|
|
3504
|
+
initial guess, overwritten IN PLACE with the solution.
|
|
3505
|
+
inp : numpy.ndarray, optional
|
|
3506
|
+
Collocation input coefficients (float64, size ``n_colloc_inp()``), e.g.
|
|
3507
|
+
from ``init`` and ``set_input_values``.
|
|
3508
|
+
cst : list of float, optional
|
|
3509
|
+
Constant values, in the order of ``var_constant``.
|
|
3510
|
+
"""
|
|
3511
|
+
def solve_fsens(self, var: typing.Any, inp: typing.Any = None, cst: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] | None = None) -> bool:
|
|
3512
|
+
"""
|
|
3513
|
+
Solve, then the forward sensitivities of the outputs with respect to the registered controls (``sens_jacobian``); returns True on success.
|
|
3514
|
+
|
|
3515
|
+
Parameters
|
|
3516
|
+
----------
|
|
3517
|
+
var : numpy.ndarray
|
|
3518
|
+
Collocation state coefficients (float64, size ``n_colloc_sta()``): the
|
|
3519
|
+
initial guess, overwritten IN PLACE with the solution.
|
|
3520
|
+
inp : numpy.ndarray, optional
|
|
3521
|
+
Collocation input coefficients (float64, size ``n_colloc_inp()``), e.g.
|
|
3522
|
+
from ``init`` and ``set_input_values``.
|
|
3523
|
+
cst : list of float, optional
|
|
3524
|
+
Constant values, in the order of ``var_constant``.
|
|
3525
|
+
"""
|
|
3526
|
+
def val_functions(self) -> list[float]:
|
|
3527
|
+
"""
|
|
3528
|
+
Output values after the last solve.
|
|
3529
|
+
"""
|
|
3530
|
+
@property
|
|
3531
|
+
def options(self) -> OCFESLV.Options:
|
|
3532
|
+
"""
|
|
3533
|
+
Solver options (model and collocation); transferred at ``setup()``.
|
|
3534
|
+
"""
|
|
3535
|
+
@options.setter
|
|
3536
|
+
def options(self, arg1: OCFESLV.Options) -> None:
|
|
3537
|
+
...
|
|
3538
|
+
@property
|
|
3539
|
+
def states_colloc(self) -> list[pymcpp.FFVar]:
|
|
3540
|
+
"""
|
|
3541
|
+
The states of the collocation system (after order reduction).
|
|
3542
|
+
"""
|
|
3543
|
+
class FFOCFESLV(pymcpp.FFOp):
|
|
3544
|
+
"""
|
|
3545
|
+
An OCFESLV solve embedded as an operation of the DAG: its outputs become DAG
|
|
3546
|
+
variables, functions of the DAG variables given for the solver's inputs and
|
|
3547
|
+
constants. Evaluating them solves the collocation system (monolithic or
|
|
3548
|
+
marching); differentiating them (FFGraph ``fdiff`` / ``bdiff``) uses the
|
|
3549
|
+
solver's forward or adjoint sensitivities (``options.GRADIENT``), through
|
|
3550
|
+
FFGradOCFESLV.
|
|
3551
|
+
|
|
3552
|
+
Example -- the outputs of a solver whose inputs are its control ``q`` (one DOF
|
|
3553
|
+
per time element) and a constant ``k``:
|
|
3554
|
+
|
|
3555
|
+
>>> OpOCFE = FFOCFESLV()
|
|
3556
|
+
>>> Q = [G.add_var("Q%d" % i) for i in range(len(S.control_dofs(q)))]
|
|
3557
|
+
>>> K = G.add_var("K")
|
|
3558
|
+
>>> y = OpOCFE({q: Q}, {k: [K]}, S)
|
|
3559
|
+
"""
|
|
3560
|
+
class POLICY_TYPE:
|
|
3561
|
+
"""
|
|
3562
|
+
Copy policy of the embedded solver.
|
|
3563
|
+
|
|
3564
|
+
Members:
|
|
3565
|
+
|
|
3566
|
+
SHALLOW : Refer to the solver (kept alive as long as the DAG; default)
|
|
3567
|
+
|
|
3568
|
+
COPY : Hold a deep copy of the solver
|
|
3569
|
+
|
|
3570
|
+
TRANSFER : Not available from Python (ownership transfer)
|
|
3571
|
+
"""
|
|
3572
|
+
COPY: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3573
|
+
SHALLOW: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3574
|
+
TRANSFER: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3575
|
+
__members__: typing.ClassVar[dict[str, FFOCFESLV.POLICY_TYPE]]
|
|
3576
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
3577
|
+
...
|
|
3578
|
+
def __getstate__(self) -> int:
|
|
3579
|
+
...
|
|
3580
|
+
def __hash__(self) -> int:
|
|
3581
|
+
...
|
|
3582
|
+
def __index__(self) -> int:
|
|
3583
|
+
...
|
|
3584
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3585
|
+
...
|
|
3586
|
+
def __int__(self) -> int:
|
|
3587
|
+
...
|
|
3588
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
3589
|
+
...
|
|
3590
|
+
def __repr__(self) -> str:
|
|
3591
|
+
...
|
|
3592
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3593
|
+
...
|
|
3594
|
+
def __str__(self) -> str:
|
|
3595
|
+
...
|
|
3596
|
+
@property
|
|
3597
|
+
def name(self) -> str:
|
|
3598
|
+
...
|
|
3599
|
+
@property
|
|
3600
|
+
def value(self) -> int:
|
|
3601
|
+
...
|
|
3602
|
+
class GRADIENT_TYPE:
|
|
3603
|
+
"""
|
|
3604
|
+
Reduced-space gradient mode.
|
|
3605
|
+
|
|
3606
|
+
Members:
|
|
3607
|
+
|
|
3608
|
+
FORWARD : One forward-sensitivity solve per control DOF
|
|
3609
|
+
|
|
3610
|
+
ADJOINT : One adjoint solve per output function
|
|
3611
|
+
|
|
3612
|
+
AUTO : ADJOINT when n_control_dof > NP2NF * n_colloc_fct, else FORWARD (default)
|
|
3613
|
+
"""
|
|
3614
|
+
ADJOINT: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3615
|
+
AUTO: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3616
|
+
FORWARD: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3617
|
+
__members__: typing.ClassVar[dict[str, FFOCFESLV.GRADIENT_TYPE]]
|
|
3618
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
3619
|
+
...
|
|
3620
|
+
def __getstate__(self) -> int:
|
|
3621
|
+
...
|
|
3622
|
+
def __hash__(self) -> int:
|
|
3623
|
+
...
|
|
3624
|
+
def __index__(self) -> int:
|
|
3625
|
+
...
|
|
3626
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3627
|
+
...
|
|
3628
|
+
def __int__(self) -> int:
|
|
3629
|
+
...
|
|
3630
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
3631
|
+
...
|
|
3632
|
+
def __repr__(self) -> str:
|
|
3633
|
+
...
|
|
3634
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3635
|
+
...
|
|
3636
|
+
def __str__(self) -> str:
|
|
3637
|
+
...
|
|
3638
|
+
@property
|
|
3639
|
+
def name(self) -> str:
|
|
3640
|
+
...
|
|
3641
|
+
@property
|
|
3642
|
+
def value(self) -> int:
|
|
3643
|
+
...
|
|
3644
|
+
class Options:
|
|
3645
|
+
"""
|
|
3646
|
+
Options of FFOCFESLV, FFGradOCFESLV and FFOCFERES, shared by all operations
|
|
3647
|
+
(class-level: ``FFOCFESLV.options``).
|
|
3648
|
+
"""
|
|
3649
|
+
@property
|
|
3650
|
+
def GRADIENT(self) -> int:
|
|
3651
|
+
"""
|
|
3652
|
+
Reduced-space gradient mode: FFOCFESLV.FORWARD, ADJOINT or AUTO.
|
|
3653
|
+
"""
|
|
3654
|
+
@GRADIENT.setter
|
|
3655
|
+
def GRADIENT(self, arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3656
|
+
...
|
|
3657
|
+
@property
|
|
3658
|
+
def NP2NF(self) -> float:
|
|
3659
|
+
"""
|
|
3660
|
+
Control-to-output ratio above which AUTO uses adjoint sensitivities.
|
|
3661
|
+
"""
|
|
3662
|
+
@NP2NF.setter
|
|
3663
|
+
def NP2NF(self, arg0: typing.SupportsFloat | typing.SupportsIndex) -> None:
|
|
3664
|
+
...
|
|
3665
|
+
@property
|
|
3666
|
+
def SYMDIFF(self) -> list[pymcpp.FFVar]:
|
|
3667
|
+
"""
|
|
3668
|
+
Inputs or constants of the operation differentiated SYMBOLICALLY; the others
|
|
3669
|
+
numerically (sensitivities).
|
|
3670
|
+
"""
|
|
3671
|
+
@SYMDIFF.setter
|
|
3672
|
+
def SYMDIFF(self, arg0: collections.abc.Sequence[pymcpp.FFVar]) -> None:
|
|
3673
|
+
...
|
|
3674
|
+
ADJOINT: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3675
|
+
AUTO: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3676
|
+
COPY: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3677
|
+
FORWARD: typing.ClassVar[FFOCFESLV.GRADIENT_TYPE]
|
|
3678
|
+
SHALLOW: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3679
|
+
TRANSFER: typing.ClassVar[FFOCFESLV.POLICY_TYPE]
|
|
3680
|
+
options: typing.ClassVar[FFOCFESLV.Options]
|
|
3681
|
+
"""
|
|
3682
|
+
Options shared by every FFOCFESLV, FFGradOCFESLV and FFOCFERES operation.
|
|
3683
|
+
"""
|
|
3684
|
+
@typing.overload
|
|
3685
|
+
def __call__(self, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], rest: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: OCFESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
3686
|
+
"""
|
|
3687
|
+
TWO-MAP form: the outputs of the solve.
|
|
3688
|
+
|
|
3689
|
+
Parameters
|
|
3690
|
+
----------
|
|
3691
|
+
diff : dict
|
|
3692
|
+
Map 1: the inputs the numerical gradient is taken with respect to (the
|
|
3693
|
+
controls), in the order of the gradient columns. Each maps to its DOFs as
|
|
3694
|
+
DAG variables: a list in ``control_dofs`` order, or a generator ``gen(dof)
|
|
3695
|
+
-> FFVar``. It resets the solver's control registry to exactly these
|
|
3696
|
+
inputs.
|
|
3697
|
+
rest : dict
|
|
3698
|
+
Map 2: every other declared input and every constant (one variable each),
|
|
3699
|
+
whose values pass through the DAG with zero numerical derivative.
|
|
3700
|
+
solver : OCFESLV
|
|
3701
|
+
The solver (set up). Under SHALLOW (default) the operation refers to
|
|
3702
|
+
``solver``, which is then kept alive as long as the DAG; under COPY it
|
|
3703
|
+
holds its own copy.
|
|
3704
|
+
policy : FFOCFESLV.POLICY_TYPE, optional
|
|
3705
|
+
SHALLOW (default) or COPY.
|
|
3706
|
+
name : str, optional
|
|
3707
|
+
Name of the operation in the DAG.
|
|
3708
|
+
"""
|
|
3709
|
+
@typing.overload
|
|
3710
|
+
def __call__(self, diff: dict[pymcpp.FFVar, collections.abc.Sequence[pymcpp.FFVar] | collections.abc.Callable[[FFModel.DofIndex], pymcpp.FFVar]], solver: OCFESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
3711
|
+
"""
|
|
3712
|
+
ONE-MAP form: every declared input is differentiated and the model has no
|
|
3713
|
+
constant (refused, naming what is missing, otherwise). Arguments as the
|
|
3714
|
+
two-map form.
|
|
3715
|
+
"""
|
|
3716
|
+
def __init__(self) -> None:
|
|
3717
|
+
"""
|
|
3718
|
+
Default constructor.
|
|
3719
|
+
"""
|
|
3720
|
+
class FFGradOCFESLV(pymcpp.FFOp):
|
|
3721
|
+
"""
|
|
3722
|
+
The derivative operation of FFOCFESLV, created when an FFOCFESLV output is
|
|
3723
|
+
differentiated (FFGraph ``fdiff`` / ``bdiff``); not constructed directly.
|
|
3724
|
+
"""
|
|
3725
|
+
class FFOCFERES(pymcpp.FFOp):
|
|
3726
|
+
"""
|
|
3727
|
+
The collocation system of an OCFESLV as an operation of the DAG: given DAG
|
|
3728
|
+
variables for the collocation state coefficients (``n_colloc_sta()``), the
|
|
3729
|
+
collocation input coefficients (``n_colloc_inp()``) and the constants, its
|
|
3730
|
+
values are the collocation residuals (``n_colloc_eqn()``) followed by the
|
|
3731
|
+
outputs (``n_colloc_fct()``) -- the constraints and objective terms of a
|
|
3732
|
+
full-discretisation formulation. Its derivatives are the sparse collocation
|
|
3733
|
+
Jacobian, through FFGradOCFERES.
|
|
3734
|
+
"""
|
|
3735
|
+
class POLICY_TYPE:
|
|
3736
|
+
"""
|
|
3737
|
+
Copy policy of the embedded solver.
|
|
3738
|
+
|
|
3739
|
+
Members:
|
|
3740
|
+
|
|
3741
|
+
SHALLOW : Refer to the solver (kept alive as long as the DAG)
|
|
3742
|
+
|
|
3743
|
+
COPY : Hold a deep copy of the solver (default)
|
|
3744
|
+
|
|
3745
|
+
TRANSFER : Not available from Python (ownership transfer)
|
|
3746
|
+
"""
|
|
3747
|
+
COPY: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3748
|
+
SHALLOW: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3749
|
+
TRANSFER: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3750
|
+
__members__: typing.ClassVar[dict[str, FFOCFERES.POLICY_TYPE]]
|
|
3751
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
3752
|
+
...
|
|
3753
|
+
def __getstate__(self) -> int:
|
|
3754
|
+
...
|
|
3755
|
+
def __hash__(self) -> int:
|
|
3756
|
+
...
|
|
3757
|
+
def __index__(self) -> int:
|
|
3758
|
+
...
|
|
3759
|
+
def __init__(self, value: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3760
|
+
...
|
|
3761
|
+
def __int__(self) -> int:
|
|
3762
|
+
...
|
|
3763
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
3764
|
+
...
|
|
3765
|
+
def __repr__(self) -> str:
|
|
3766
|
+
...
|
|
3767
|
+
def __setstate__(self, state: typing.SupportsInt | typing.SupportsIndex) -> None:
|
|
3768
|
+
...
|
|
3769
|
+
def __str__(self) -> str:
|
|
3770
|
+
...
|
|
3771
|
+
@property
|
|
3772
|
+
def name(self) -> str:
|
|
3773
|
+
...
|
|
3774
|
+
@property
|
|
3775
|
+
def value(self) -> int:
|
|
3776
|
+
...
|
|
3777
|
+
COPY: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3778
|
+
SHALLOW: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3779
|
+
TRANSFER: typing.ClassVar[FFOCFERES.POLICY_TYPE]
|
|
3780
|
+
@typing.overload
|
|
3781
|
+
def __call__(self, sta: collections.abc.Sequence[pymcpp.FFVar], inp: collections.abc.Sequence[pymcpp.FFVar], cst: collections.abc.Sequence[pymcpp.FFVar], solver: OCFESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
3782
|
+
"""
|
|
3783
|
+
The collocation residuals then the outputs, as DAG variables.
|
|
3784
|
+
|
|
3785
|
+
Parameters
|
|
3786
|
+
----------
|
|
3787
|
+
sta : list of FFVar
|
|
3788
|
+
DAG variables for the collocation state coefficients (``n_colloc_sta()``).
|
|
3789
|
+
inp : list of FFVar
|
|
3790
|
+
DAG variables for the collocation input coefficients (``n_colloc_inp()``).
|
|
3791
|
+
cst : list of FFVar
|
|
3792
|
+
DAG variables for the constants, in the order of ``var_constant``.
|
|
3793
|
+
solver : OCFESLV
|
|
3794
|
+
The solver (set up, monolithic).
|
|
3795
|
+
policy : FFOCFERES.POLICY_TYPE, optional
|
|
3796
|
+
COPY (default) or SHALLOW.
|
|
3797
|
+
name : str, optional
|
|
3798
|
+
Name of the operation in the DAG.
|
|
3799
|
+
"""
|
|
3800
|
+
@typing.overload
|
|
3801
|
+
def __call__(self, sta: collections.abc.Sequence[pymcpp.FFVar], inp: collections.abc.Sequence[pymcpp.FFVar], solver: OCFESLV, policy: typing.SupportsInt | typing.SupportsIndex = ..., name: str = '') -> list[pymcpp.FFVar]:
|
|
3802
|
+
"""
|
|
3803
|
+
As above, for a model without constants.
|
|
3804
|
+
"""
|
|
3805
|
+
def __init__(self) -> None:
|
|
3806
|
+
"""
|
|
3807
|
+
Default constructor.
|
|
3808
|
+
"""
|
|
3809
|
+
class FFGradOCFERES(pymcpp.FFOp):
|
|
3810
|
+
"""
|
|
3811
|
+
The derivative operation of FFOCFERES, created when an FFOCFERES output is
|
|
3812
|
+
differentiated; not constructed directly.
|
|
3813
|
+
"""
|
|
3814
|
+
def build_info() -> dict:
|
|
3815
|
+
"""
|
|
3816
|
+
Describe this build of CRONOS: ``version``, ``license`` (``"EPL-2.0"``, or ``"GPL-2.0-or-later"`` when the GPL
|
|
3817
|
+
SuiteSparse backends UMFPACK or SPQR are compiled in), ``license_note``, ``backends`` (which linear-algebra backends
|
|
3818
|
+
are compiled in) and ``pymcpp`` (the version of the pymcpp module loaded alongside).
|
|
3819
|
+
"""
|
|
3820
|
+
__version__: str = '5.0.0'
|