Skip to content

Commit e219220

Browse files
author
chmerdon
committed
fix in restrictions in case the problem does not solve for the full sol vector
1 parent 01b9ac9 commit e219220

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ authors = ["Christian Merdon <merdon@wias-berlin.de>", "Patrick Jaap <patrick.ja
55

66
[deps]
77
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
8+
CatViews = "81a5f4ea-a946-549a-aa7e-2a7f63a27d31"
89
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
910
CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
1011
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
@@ -29,6 +30,7 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
2930
[compat]
3031
Aqua = "0.8"
3132
BlockArrays = "1.7.0"
33+
CatViews = "1.0.0"
3234
ChunkSplitters = "3.1.2"
3335
CommonSolve = "0.2"
3436
DiffResults = "1"

src/ExtendableFEM.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module ExtendableFEM
77

88
using ChunkSplitters: chunks
99
using BlockArrays: BlockMatrix, BlockVector, Block, blocks, axes
10+
using CatViews: CatView
1011
using CommonSolve: CommonSolve
1112
using DiffResults: DiffResults
1213
using DocStringExtensions: DocStringExtensions, TYPEDEF, TYPEDSIGNATURES

src/solvers.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ function solve_linear_system!(A, b, sol, soltemp, residual, linsolve, unknowns,
253253
b_unrestricted = residual.entries
254254
end
255255

256+
## restrictions only involve the blocks coressponding to the unknowns and not necessarily the full sol.entries
257+
sol_freedofs = CatView([view(sol[u]) for u in unknowns]...)
258+
256259
if length(PD.restrictions) == 0
257260
if linsolve_needs_matrix
258261
linsolve.A = A_unrestricted
@@ -273,7 +276,7 @@ function solve_linear_system!(A, b, sol, soltemp, residual, linsolve, unknowns,
273276

274277
## we need to add the (initial) solution to the rhs, since we work with the residual equation
275278
for (B, rhs) in zip(restriction_matrices, restriction_rhs)
276-
rhs .-= B'sol.entries
279+
rhs .-= B'sol_freedofs
277280
end
278281

279282
total_size = sum(block_sizes)

0 commit comments

Comments
 (0)