fixed a little bug in simplesolver, now local solution is updated correctly.

This commit is contained in:
Jukka Aho
2015-11-18 10:32:18 +02:00
parent ebad4a3062
commit 106f6f80b2
2 changed files with 7 additions and 9 deletions
+6 -8
View File
@@ -93,12 +93,12 @@ end
## SimpleSolver -- tiny direct demo solver
""" Simple solver for educational purposes. """
type SimpleSolver <: Solver
problems
problems :: Vector{Problem}
end
""" Default initializer. """
function SimpleSolver()
SimpleSolver(Problem[])
SimpleSolver([])
end
"""
@@ -143,9 +143,8 @@ function call(solver::SimpleSolver, time::Number=0.0)
element = get_element(equation)
field_name = get_unknown_field_name(problem1)
gdofs = get_gdofs(problem1, equation)
element_solution = full(x1[gdofs])
field = Increment(element_solution)
push!(element[field_name], TimeStep(time, field))
local_sol = vec(full(x1[gdofs]))
push!(element[field_name], time => local_sol)
end
# update field for elements in problem 2 (Dirichlet boundary)
@@ -153,9 +152,8 @@ function call(solver::SimpleSolver, time::Number=0.0)
element = get_element(equation)
field_name = get_unknown_field_name(problem2)
gdofs = get_gdofs(problem2, equation)
element_solution = full(x2[gdofs])
field = Increment(element_solution)
push!(element[field_name], TimeStep(time, field))
local_sol = vec(full(x1[gdofs]))
push!(element[field_name], time => local_sol)
end
end
+1 -1
View File
@@ -64,7 +64,7 @@ function test_simplesolver()
X = basis("geometry", xi, 1.0)
T = basis("temperature", xi, 1.0)
info("Temperature at point X = $X is T = $T")
@test isapprox(mean(T), 100.0)
@test isapprox(T, 100.0)
end
end