From 4f611f56947c3c5ffc629ed7e5085c08be3af0f4 Mon Sep 17 00:00:00 2001 From: Mark Messner Date: Thu, 21 Mar 2024 20:33:45 -0500 Subject: [PATCH] Hopefully formatting fixed --- pyoptmat/flowrules.py | 5 ++++- pyoptmat/models.py | 9 +++++---- pyoptmat/ode.py | 2 +- pyoptmat/optimize.py | 2 ++ pyoptmat/solvers.py | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pyoptmat/flowrules.py b/pyoptmat/flowrules.py index 987e2dd..ee05536 100644 --- a/pyoptmat/flowrules.py +++ b/pyoptmat/flowrules.py @@ -1,4 +1,4 @@ -# pylint: disable=abstract-method, useless-super-delegation, line-too-long, duplicate-code, too-many-lines +# pylint: disable=abstract-method, useless-super-delegation, line-too-long, duplicate-code, too-many-lines, too-many-arguments, too-many-public-methods """ Module containing inelastic flow rules. These provide the rate of the @@ -514,6 +514,9 @@ def f(self, T, e): return (torch.tanh(self.sf * (self.g(T, e) - self.g0())) + 1.0) / 2.0 def g0(self): + """ + The intercept value + """ return (self.C_scale.scale(self.C) - self.B_scale.scale(self.B)) / self.A_scale( self.A ) diff --git a/pyoptmat/models.py b/pyoptmat/models.py index 1aa9e64..ccca4dc 100644 --- a/pyoptmat/models.py +++ b/pyoptmat/models.py @@ -453,9 +453,9 @@ def __init__( base, temps, control, + *args, bisect_first=False, throw_on_scalar_fail=False, - *args, **kwargs ): super().__init__(*args, **kwargs) @@ -566,12 +566,12 @@ def __init__( srate_fn, stress_fn, T_fn, + *args, min_erate=-1e2, max_erate=1e3, guess_erate=1.0e-3, bisect_first=False, throw_on_scalar_fail=False, - *args, **kwargs ): super().__init__(*args, **kwargs) @@ -626,8 +626,9 @@ def RJ(erate): t, torch.cat([cs.unsqueeze(-1), y[..., 1:]], dim=-1), erate, cT ) - # There is an annoying extra term that is the derivative of the history rate with respect to the - # solved for strain rate times the derivative of the strain rate with respect to history + # There is an annoying extra term that is the derivative of the + # history rate with respect to the solved for strain rate times + # the derivative of the strain rate with respect to history t1 = Je[..., 1:].unsqueeze(-1) t2 = utility.mbmm(1.0 / Je[..., :1].unsqueeze(-1), J[..., 0, 1:].unsqueeze(-2)) t3 = utility.mbmm(t1, t2) diff --git a/pyoptmat/ode.py b/pyoptmat/ode.py index ce2398b..76ef0d8 100644 --- a/pyoptmat/ode.py +++ b/pyoptmat/ode.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-arguments +# pylint: disable=too-many-arguments, too-many-instance-attributes """ Module defining the key objects and functions to integrate ODEs diff --git a/pyoptmat/optimize.py b/pyoptmat/optimize.py index 06eb0b0..5bd6dcb 100644 --- a/pyoptmat/optimize.py +++ b/pyoptmat/optimize.py @@ -1,3 +1,5 @@ +# pylint: disable=too-many-instance-attributes, too-many-arguments, not-context-manager + """ Objects and helper functions to help with deterministic model calibration and statistical inference. diff --git a/pyoptmat/solvers.py b/pyoptmat/solvers.py index 7c7a1c1..658af48 100644 --- a/pyoptmat/solvers.py +++ b/pyoptmat/solvers.py @@ -30,7 +30,7 @@ def scalar_bisection(fn, a, b, atol=1.0e-6, miter=100): c = (a + b) / 2.0 Rc, _ = fn(c) - for i in range(miter): + for _ in range(miter): if torch.all(torch.abs(Rc) < atol): break @@ -60,7 +60,7 @@ def scalar_newton(fn, x0, atol=1.0e-6, miter=100, throw_on_fail=False): x = x0 R, J = fn(x) - for i in range(miter): + for _ in range(miter): if torch.all(torch.abs(R) < atol): break