Skip to content

Commit

Permalink
Fixed LinearFETerm for multi-field computations
Browse files Browse the repository at this point in the history
  • Loading branch information
fverdugo committed Sep 2, 2019
1 parent 7e82c93 commit 2b957d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/MultiField/MultiCellMaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ function (-)(a::MultiCellMap{N},b::MultiCellMap{N}) where N
MultiCellMap(blocks,fieldids)
end

function (-)(b::MultiCellMap{N}) where N
blocks = CellMap[]
append!(blocks,[ -k for k in b.blocks])
MultiCellMap(blocks,b.fieldids)
end

end # module
6 changes: 4 additions & 2 deletions test/MultiFieldTests/MultiFEOperatorsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ bquad = CellQuadrature(btrian,order=2)
# Terms in the volume
a(v,u) = inner((v[1]),(u[1])) + inner(v[1],u[2]) + inner((v[2]),(u[2]))
b(v) = inner(v[1],b1fun) + inner(v[2],b2fun)
t_Ω = AffineFETerm(a,b,trian,quad)
t_Ωa = LinearFETerm(a,trian,quad)
t_Ωb = FESource(b,trian,quad)

# Terms on Neumann boundary
# Note that the Neumann BC only applies on the first field
Expand All @@ -63,7 +64,7 @@ t_Γ = FESource(g,btrian,bquad)
assem = SparseMatrixAssembler(V,U)

# Define the FEOperator
op = LinearFEOperator(V,U,assem,t_Ω,t_Γ)
op = LinearFEOperator(V,U,assem,t_Ωa,t_Ωb,t_Γ)

# Define the FESolver
ls = LUSolver()
Expand Down Expand Up @@ -99,6 +100,7 @@ e2h1 = sqrt(sum( integrate(h1(e2),trian,quad) ))

# Further tests

t_Ω = AffineFETerm(a,b,trian,quad)
op = LinearFEOperator(a,b,V,U,assem,trian,quad)
op = LinearFEOperator(V,U,t_Ω,t_Γ)
op = LinearFEOperator(V,U,t_Ω)
Expand Down

1 comment on commit 2b957d1

@fverdugo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santiagobadia LinearFETerm fixed for multi-field computations.

Please sign in to comment.