@@ -11,7 +11,7 @@ def test_solverstate_basic(self):
11
11
"""
12
12
n = 1
13
13
size = 5
14
- mesh = UnitSquareMesh (size ,size )
14
+ mesh = UnitSquareMesh (size , size )
15
15
V = FunctionSpace (mesh , 'P' , 2 )
16
16
dummy_value = 1
17
17
E = Expression ("t" , t = dummy_value , degree = 2 )
@@ -22,24 +22,24 @@ def test_solverstate_basic(self):
22
22
# "read checkpoint"
23
23
u_cp , t_cp , n_cp = sstate .get_state ()
24
24
25
- #check values
25
+ # check values
26
26
self .assertEqual (t_cp , dummy_value )
27
27
self .assertEqual (n , n_cp )
28
- #function should be the same everywhere (-> check vector values of the function)
28
+ # function should be the same everywhere (-> check vector values of the function)
29
29
vec_u = u .vector ()
30
30
vec_u_cp = u_cp .vector ()
31
- for i in range (size * size ):
31
+ for i in range (size * size ):
32
32
self .assertAlmostEqual (vec_u [i ], vec_u_cp [i ])
33
33
34
34
def test_solverstate_modification_vector (self ):
35
35
"""
36
- Check if correct values are read from the checkpoint, if the dof vector of the dolfin functions are changed directly
36
+ Check if correct values are read from the checkpoint, if the dof vector of the dolfin functions are changed directly
37
37
38
38
Motivation for this test: Related to https://github.com/precice/fenics-adapter/pull/172 and https://github.com/precice/tutorials/pull/554
39
39
"""
40
40
n = 1
41
41
size = 5
42
- mesh = UnitSquareMesh (size ,size )
42
+ mesh = UnitSquareMesh (size , size )
43
43
V = FunctionSpace (mesh , 'P' , 2 )
44
44
ref_value = 1
45
45
E = Expression ("t" , t = ref_value , degree = 2 )
@@ -55,13 +55,12 @@ def test_solverstate_modification_vector(self):
55
55
# "read checkpoint"
56
56
u_cp , _ , _ = sstate .get_state ()
57
57
58
- #check values
59
- #function should be the same everywhere
60
- #(so the vector values should all be ref_value)
58
+ # check values
59
+ # function should be the same everywhere
60
+ # (so the vector values should all be ref_value)
61
61
vec_u_cp = u_cp .vector ()
62
- for i in range (size * size ):
62
+ for i in range (size * size ):
63
63
self .assertAlmostEqual (ref_value , vec_u_cp [i ])
64
-
65
64
66
65
def test_solverstate_modification_assign (self ):
67
66
"""
@@ -70,7 +69,7 @@ def test_solverstate_modification_assign(self):
70
69
"""
71
70
n = 1
72
71
size = 5
73
- mesh = UnitSquareMesh (size ,size )
72
+ mesh = UnitSquareMesh (size , size )
74
73
V = FunctionSpace (mesh , 'P' , 2 )
75
74
ref_value = 1
76
75
E = Expression ("t" , t = ref_value , degree = 2 )
@@ -83,15 +82,15 @@ def test_solverstate_modification_assign(self):
83
82
# "compute" new solution
84
83
dummy_value = ref_value + 2
85
84
E .t = dummy_value
86
- u2 = interpolate (E ,V )
85
+ u2 = interpolate (E , V )
87
86
u .assign (u2 )
88
87
89
88
# "read checkpoint"
90
89
u_cp , _ , _ = sstate .get_state ()
91
90
92
- #check values
93
- #function should be the same everywhere
94
- #(so the vector values should all be ref_value)
91
+ # check values
92
+ # function should be the same everywhere
93
+ # (so the vector values should all be ref_value)
95
94
vec_u_cp = u_cp .vector ()
96
- for i in range (size * size ):
95
+ for i in range (size * size ):
97
96
self .assertAlmostEqual (ref_value , vec_u_cp [i ])
0 commit comments