Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
reverendbedford committed Mar 22, 2024
1 parent 65fcd41 commit 8aedafb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions examples/ode/damping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions pyoptmat/flowrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 8aedafb

Please sign in to comment.