Skip to content

Commit

Permalink
Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
reverendbedford committed Jan 8, 2025
1 parent 6dc38a0 commit a4ea10c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
CMAKE_MINIMUM_REQUIRED(VERSION 3.30)
project(NEML LANGUAGES CXX)

### Version ###
Expand Down
16 changes: 16 additions & 0 deletions test/test_hardening.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ def test_relation(self):
self.assertTrue(np.isclose(self.model.q(self.hist_trial, self.T)[0],
-self.ifn(self.hist_trial[0])))

class TestTemperatureDependentInterpolatedIsotropicHardening(unittest.TestCase, CommonHardening):
def setUp(self):
self.temperatures = [100.0,200.0]
self.points = [0.0, 0.01, 0.02, 0.05]
self.values = [[100.0, 110.0, 130.0, 135.0], [200.0, 220.0, 260.0, 270.0]]
self.ifns = [interpolate.PiecewiseLinearInterpolate(self.points, v) for v in self.values]
self.hist0 = np.array([0.0])
self.hist_trial = np.array([0.03])
self.T = 150.0

self.model = hardening.TemperatureDependentInterpolatedIsotropicHardeningRule(self.temperatures, self.ifns)

def test_relation(self):
self.assertTrue(np.isclose(self.model.q(self.hist_trial, self.T)[0],
-(self.ifns[0](self.hist_trial[0])+self.ifns[1](self.hist_trial[0]))/2.0))


class TestVoceIsotropicHardening(unittest.TestCase, CommonHardening):
def setUp(self):
Expand Down

0 comments on commit a4ea10c

Please sign in to comment.