Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in AffineFEOperator parallel assembly #142

Closed
amartinhuertas opened this issue Jan 27, 2024 · 1 comment
Closed

Bug in AffineFEOperator parallel assembly #142

amartinhuertas opened this issue Jan 27, 2024 · 1 comment
Assignees

Comments

@amartinhuertas
Copy link
Member

amartinhuertas commented Jan 27, 2024

The MWE below reproduces the error.

Brief explanation of the problem: when assembling an AffineFEOperator such that:

the linear form has terms that touch ghost DoFs which are not touched by the assembly of the terms in the bilinear form

GridapDistributed.jl wrongly computes the communication pattern which is required to properly assemble the right hand side vector of the linear system.

This is so because it (wrongly) assumes that the ghost layout of the PRange describing the partition of the rows of the linear system coefficient matrix matches that of the right hand side vector. This is general true, but not necessarily, as, e.g., in the mwe example below.

I will try to fix the issue in a PR following this issue.

using Gridap

# Parallel distributed packages
using PartitionedArrays
using GridapDistributed
using Test

function run_app(rank_partition,distribute)
  DX             = 1000.0
  DY             = 1000.0
  order          = 0
  n_els_x        = 4
  n_els_y        = 4
  dx             = DX/n_els_x
  domain         = (0,DX,0,DY)
  cell_partition = (n_els_x,n_els_y)
  ranks          = distribute(LinearIndices((prod(rank_partition),)))

  model = CartesianDiscreteModel(ranks,rank_partition,domain,cell_partition; isperiodic=(false,false))
  Ω   = Triangulation(model)
  dΩ  = Measure(Ω, 5*(order+1))
  Γ   = SkeletonTriangulation(model)
  dΓ  = Measure(Γ, 5*(order+1))

  Q = FESpace(model, ReferenceFE(lagrangian, Float64, order), conformity=:L2)
  P = TrialFESpace(Q)

  # initial conditions
  ph=FEFunction(P,prand(partition(Q.gids)))

  b(q)   = (jump(ph)*mean(q))dΓ
  m(p,q) = (p*q)dΩ
  op = AffineFEOperator(m, b, P, Q)
  b=assemble_vector(b(get_fe_basis(Q)),P)
  tol=1.0e-12
  @test norm(op.op.vector-b)/norm(b) < tol
end 

rank_partition = (2,1)
with_debug() do distribute
  run_app(rank_partition,distribute)
end
@amartinhuertas amartinhuertas self-assigned this Jan 27, 2024
amartinhuertas added a commit to gridap/Gridap.jl that referenced this issue Jan 28, 2024
it also takes into account the symbolic part corresponding to vector
entries.

This is a feature required to fix issue 142 in gridapdistributed.jl

gridap/GridapDistributed.jl#142
@amartinhuertas
Copy link
Member Author

Addressed by #143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant