Skip to content

Commit c63f67d

Browse files
authored
Merge pull request #85 from WIAS-PDELib/fix/residual
Fix fixed_dofs of CoupledDofsRestriction
2 parents 176eb1a + a90a4f2 commit c63f67d

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

examples/Example212_PeriodicBoundary2D.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ function main(;
163163
end
164164
end
165165

166-
sol = solve(PD, FES)
166+
sol, SC = solve(PD, FES, return_config = true)
167+
residual(SC) < 1.0e-10 || error("Residual is not zero!")
167168

168169
plt = GridVisualizer(; Plotter, size = (1300, 800))
169170

examples/Example312_PeriodicBoundary3D.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ function main(;
179179
end
180180

181181
## solve
182-
sol = solve(PD, FES; kwargs...)
182+
sol, SC = solve(PD, FES; return_config = true, kwargs...)
183+
residual(SC) < 1.0e-10 || error("Residual is not zero!")
183184

184185
displace_mesh!(xgrid, sol[u])
185186
plt = plot([grid(u)], sol; Plotter, do_vector_plots = false, width = 1200, height = 800, title = "displaced mesh", scene3d = :LScene)

src/common_restrictions/coupled_dofs_restriction.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ function assemble!(R::CoupledDofsRestriction, sol, SC; kwargs...)
3333

3434
R.parameters[:matrix] = B
3535
R.parameters[:rhs] = Zeros(length(unique_cols))
36-
R.parameters[:fixed_dofs] = unique_cols
36+
37+
# fixed dofs are all active rows of B
38+
I, _, _ = findnz(B)
39+
R.parameters[:fixed_dofs] = unique(I)
3740

3841
return nothing
3942
end

0 commit comments

Comments
 (0)