diff --git a/examples/ode/damping.py b/examples/ode/damping.py index 61bcc7f..e714dbe 100755 --- a/examples/ode/damping.py +++ b/examples/ode/damping.py @@ -35,14 +35,11 @@ sys.path.append("../..") from pyoptmat import ode, utility, neuralode -if torch.cuda.is_available(): - dev = "cuda:0" -else: - dev = "cpu" +dev = "cpu" device = torch.device(dev) # I'm assuming single precision will be fine for this but for now use doubles -torch.set_default_tensor_type(torch.DoubleTensor) +torch.set_default_dtype(torch.float64) class MassDamperSpring(torch.nn.Module): diff --git a/examples/structural-material-models/kocks-mecking-differentiable.py b/examples/structural-material-models/kocks-mecking-differentiable.py index b0d15f4..1712b3f 100755 --- a/examples/structural-material-models/kocks-mecking-differentiable.py +++ b/examples/structural-material-models/kocks-mecking-differentiable.py @@ -48,7 +48,6 @@ def calculate_yield(strain, stress, offset=0.2 / 100.0): mu = temperature.PolynomialScaling( [-2.60610204e-05, 3.61911162e-02, -4.23765368e01, 8.44212545e04] ) - g0 = torch.tensor(0.771) k = torch.tensor(1.38064e-20) b = torch.tensor(2.019e-7) eps0 = torch.tensor(1.0e6) @@ -81,7 +80,7 @@ def calculate_yield(strain, stress, offset=0.2 / 100.0): sf = torch.tensor(50.0) flowrule = flowrules.SoftKocksMeckingRegimeFlowRule( - ri_flowrule, rd_flowrule, g0, mu, b, eps0, k, sf + ri_flowrule, rd_flowrule, A, B, C, mu, b, eps0, k, sf ) model = models.InelasticModel(E, flowrule) diff --git a/pyoptmat/flowrules.py b/pyoptmat/flowrules.py index cd873c9..a422325 100644 --- a/pyoptmat/flowrules.py +++ b/pyoptmat/flowrules.py @@ -517,9 +517,7 @@ def g0(self): """ The intercept value """ - return (self.C_scale(self.C) - self.B_scale(self.B)) / self.A_scale( - self.A - ) + return (self.C_scale(self.C) - self.B_scale(self.B)) / self.A_scale(self.A) def df_e(self, T, e): """