@@ -37,7 +37,7 @@ def test_simple_solve(rg):
3737 mesh = IntervalMesh (10 , 0 , 1 )
3838 V = FunctionSpace (mesh , "Lagrange" , 1 )
3939
40- f = Function (V ).assign (2 )
40+ f = Function (V ).assign (2. )
4141
4242 u = TrialFunction (V )
4343 v = TestFunction (V )
@@ -76,10 +76,10 @@ def test_mixed_derivatives(rg):
7676 mesh = IntervalMesh (10 , 0 , 1 )
7777 V = FunctionSpace (mesh , "Lagrange" , 1 )
7878
79- f = Function (V ).assign (2 )
79+ f = Function (V ).assign (2. )
8080 control_f = Control (f )
8181
82- g = Function (V ).assign (3 )
82+ g = Function (V ).assign (3. )
8383 control_g = Control (g )
8484
8585 u = TrialFunction (V )
@@ -126,7 +126,7 @@ def test_function(rg):
126126 R = FunctionSpace (mesh , "R" , 0 )
127127 c = Function (R , val = 4 )
128128 control_c = Control (c )
129- f = Function (V ).assign (3 )
129+ f = Function (V ).assign (3. )
130130 control_f = Control (f )
131131
132132 u = Function (V )
@@ -139,14 +139,14 @@ def test_function(rg):
139139 J = assemble (c ** 2 * u ** 2 * dx )
140140
141141 Jhat = ReducedFunctional (J , [control_c , control_f ])
142- dJdc , dJdf = compute_gradient (J , [control_c , control_f ], apply_riesz = True )
142+ dJdc , dJdf = compute_derivative (J , [control_c , control_f ], apply_riesz = True )
143143
144144 # Step direction for derivatives and convergence test
145145 h_c = Function (R , val = 1.0 )
146146 h_f = rg .uniform (V , 0 , 10 )
147147
148148 # Total derivative
149- dJdc , dJdf = compute_gradient (J , [control_c , control_f ], apply_riesz = True )
149+ dJdc , dJdf = compute_derivative (J , [control_c , control_f ], apply_riesz = True )
150150 dJdm = assemble (dJdc * h_c * dx + dJdf * h_f * dx )
151151
152152 # Hessian
@@ -163,7 +163,7 @@ def test_nonlinear(rg):
163163 mesh = UnitSquareMesh (10 , 10 )
164164 V = FunctionSpace (mesh , "Lagrange" , 1 )
165165 R = FunctionSpace (mesh , "R" , 0 )
166- f = Function (V ).assign (5 )
166+ f = Function (V ).assign (5. )
167167
168168 u = Function (V )
169169 v = TestFunction (V )
@@ -201,11 +201,11 @@ def test_dirichlet(rg):
201201 mesh = UnitSquareMesh (10 , 10 )
202202 V = FunctionSpace (mesh , "Lagrange" , 1 )
203203
204- f = Function (V ).assign (30 )
204+ f = Function (V ).assign (30. )
205205
206206 u = Function (V )
207207 v = TestFunction (V )
208- c = Function (V ).assign (1 )
208+ c = Function (V ).assign (1. )
209209 bc = DirichletBC (V , c , "on_boundary" )
210210
211211 F = inner (grad (u ), grad (v )) * dx + u ** 4 * v * dx - f ** 2 * v * dx
0 commit comments