Skip to content

Commit ebc5f0a

Browse files
committed
More cleanup
1 parent fef6779 commit ebc5f0a

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/solver/linsolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function Jutul.update_preconditioner!(prec::BatteryCPhiPreconditioner, lsys, con
229229
#@exfiltrate mass_map, c, charge_map, phi
230230
end
231231

232-
function Jutul.apply!(x, prec::BatteryCPhiPreconditioner, r, arg...)
232+
function Jutul.apply!(x, prec::BatteryCPhiPreconditioner, r)
233233
(; c, phi, allvars, A) = prec.data
234234
#@. x .= r
235235
dx = allvars.x

src/solver/precondgenneral.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
function Jutul.update_preconditioner!(prec::BattMo.BatteryGeneralPreconditioner, lsys, context, model, storage, recorder, executor)
2+
function Jutul.update_preconditioner!(prec::BattMo.BatteryGeneralPreconditioner, lsys::Jutul.JutulLinearSystem, context, model, storage, recorder, executor)
33
# Solve all Phi with AMG
44
# Solve the elyte C with another AMG
55
# Let the rest be (?)
@@ -71,7 +71,7 @@ function Jutul.update_preconditioner!(prec::BattMo.BatteryGeneralPreconditioner,
7171
end
7272
Jutul.operator_nrows(p::BattMo.BatteryGeneralPreconditioner) = p.data.n
7373

74-
function Jutul.apply!(x, prec::BattMo.BatteryGeneralPreconditioner, r, arg...)
74+
function Jutul.apply!(x, prec::BattMo.BatteryGeneralPreconditioner, r)
7575
A = prec.data.A
7676
x .= 0
7777
dx = prec.data.allvars.x#copy(x) # maybe move to storage
@@ -96,7 +96,7 @@ function Jutul.apply!(x, prec::BattMo.BatteryGeneralPreconditioner, r, arg...)
9696
println("Models ", varprecond.models)
9797
#println(precond)
9898
end
99-
apply_local_preconditioner!(dx, precond, r_local, var, arg...)
99+
apply_local_preconditioner!(dx, precond, r_local, var)
100100
#println(dx)
101101
x .+= dx
102102
if prec.params["method"] == "seq"
@@ -122,7 +122,7 @@ function Jutul.apply!(x, prec::BattMo.BatteryGeneralPreconditioner, r, arg...)
122122
#error()
123123
if !isnothing(prec.g_varprecond)
124124
varprec = prec.g_varprecond
125-
Jutul.apply!(dx, varprec.precond, r_local, arg...)
125+
Jutul.apply!(dx, varprec.precond, r_local)
126126
x .+= dx
127127
Jutul.mul!(r_local, A, dx, -1, true)
128128
dx .= 0.0
@@ -199,12 +199,12 @@ function update_local_preconditioner!(varprec, A, r, ind_eq, ind_var, executor)
199199
#NB ok??
200200
#Jutul.update_preconditioner!(prec, A_s, view(r, ix), DefaultContext(), executor)
201201
end
202-
function apply_local_preconditioner!(x, prec, r, S, arg...)
202+
function apply_local_preconditioner!(x, prec, r, S)
203203
r_i = S.r
204204
x_i = S.x
205205
x_i .= 0.0
206206
ix = S.ix
207207
@. r_i = r[ix]
208-
apply!(x_i, prec, r_i,arg...)
208+
apply!(x_i, prec, r_i)
209209
@. x[ix] = x_i
210210
end

test/3d_example_amg.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ using Test
33
using AlgebraicMultigrid
44

55
@testset "3d amg" begin
6-
76
@test begin
8-
97
name = "p2d_40_jl_chen2020"
108

119
fn = string(dirname(pathof(BattMo)), "/../test/data/jsonfiles/", name, ".json")
@@ -25,7 +23,8 @@ using AlgebraicMultigrid
2523
timesteps = output[:timesteps]
2624
cfg = output[:cfg]
2725

28-
cfg[:info_level] = 0
26+
cfg[:info_level] = 0
27+
cfg[:failure_cuts_timestep] = false
2928

3029
solver = :fgmres
3130
fac = 1e-4 #NEEDED
@@ -56,15 +55,15 @@ using AlgebraicMultigrid
5655

5756
states, reports = simulate(state0, simulator, timesteps; forces=forces, config=cfg)
5857
Cc = map(x -> x[:Control][:Current][1], states)
59-
Phi = map(x -> x[:Control][:Phi][1], states)
58+
phi = map(x -> x[:Control][:Phi][1], states)
6059
@test length(states) == 77
6160
@test Cc[1] 0.00058 atol = 1e-2
6261
for i in 3:length(Cc)
6362
@test Cc[i] 0.008165 atol = 1e-2
6463
end
65-
@test Phi[1] 4.175 atol = 1e-1
66-
@test Phi[end] 2.76 atol = 1e-2
67-
@test Phi[30] 3.67 atol = 1e-2
64+
@test phi[1] 4.175 atol = 1e-1
65+
@test phi[end] 2.76 atol = 1e-2
66+
@test phi[30] 3.67 atol = 1e-2
6867
true
6968
end
7069
end

0 commit comments

Comments
 (0)