Potential issue when interpolating DistributedCelllFields that are only defined on own cells
@JordiManyer ci sta già lavorando.
Dal 21/10/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Documenting here an issue that has arisen in GridapP4est.jl/GridapGeosciences.jl when dealing with periodic distributed meshes such that owned cells are locally numbered before ghost cells.
The mwe below illustrates (although it does not reproduce) the issue (as it does not actually use a periodic distributed mesh with the features described in the previous paragraph). This mwe is to be executed with 2 MPI tasks. The triangulation Ω only includes owned cells. As a consequence, the DistributedCellField dcf is only defined on owned cells. When we interpolate the local portions of such DistributedCellField on the FESpace, the underlying code under the interpolate call (extracted here in the mwe for illustration purposes), extends the cell-wise array resulting from the cell field interpolation with zeros on the ghost cells. This particularly happens in the CellField(cf,trian,DomainStyle(dof_basis)) call. Here, the triangulation associated to the FESpace has both owned and ghost cells, while the cell field only has owned cells.
Extending with zeros the ghost cells is dangerous, as the algorithm that gathers the cell-wise DoFs into the DoF-wise array, performs a sweep starting from the first to the last cell. If the mesh is periodic, you may have (1) ghost DoFs on ghost cells that are also on owned cells, and (2) this may happen from the perspective of all processors that share such DoFs. As a consequence the consistent! call in GridapDistributed that typically fixes that with non-periodic meshes, cannot fix that with periodic meshes.
The picture below the mwe illustrates the particular scenario in which the issue is arising. The periodic mesh is distributed among 2 processors. The picture shows the local numbering of DoFs on the first processor (rank 1). The ghost DoFs on owned cells in rank 1 (marked with a cross x in the picture), end up having the value zero after consistent! (because they were overridden with zeros on both processors).
The issue can by by-passed by creating a DistributedCellField defined on a triangulation that has both owned and ghost cells. But is there a better way to handle this such that the user does not have to bother about these details? (I am thinking about this).
using Gridap
using GridapDistributed
using PartitionedArrays
using MPI
using FillArrays
MPI.Init()
ranks = distribute_with_mpi(LinearIndices((prod(MPI.Comm_size(MPI.COMM_WORLD)),)))
model = CartesianDiscreteModel(ranks, (2,1), (0,1,0,1), (4,4))
reffe = ReferenceFE(lagrangian,Float64,1)
V = FESpace(model,reffe,conformity=:H1)
Ω = Triangulation(model)
fields = map(local_views(Ω)) do Ω
println(num_cells(Ω))
Gridap.CellData.GenericCellField(Fill(Gridap.Fields.ConstantField(1.0),num_cells(Ω)), Ω, ReferenceDomain())
end
dcf = GridapDistributed.DistributedCellField(fields, Ω)
Udofs = get_free_dof_values(interpolate(dcf, V))
map(ranks, local_views(V), local_views(dcf)) do rank, V, cf
dof_basis=Gridap.FESpaces.get_fe_dof_basis(V)
trian = get_triangulation(V)
cfp = CellField(cf,trian,DomainStyle(dof_basis))
x=dof_basis(cfp)
if rank==1
println("Rank $(MPI.Comm_rank(MPI.COMM_WORLD)) x at dofs: ", x); print("\n");
end
end
- Lingua principale
- Julia
- Stelle
- 150
- Fork
- 28
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gridap/GridapDistributed.jl
-
A generic method of the abstract type DistributedDiscreteModel{Dc,Dp} directly accesses to a field name .face_gidsForse di nuovo libera @amartinhuertas l’ha presa 120 giorni fa e non c’è nessuna pull request aperta. Aperta
gridap/GridapDistributed.jl#211 · 1 assegnatario ·
-
Automatically add ghost cells to triangulation whenever a CellField is created out of a DistributedTriangulationForse di nuovo libera @JordiManyer l’ha presa 153 giorni fa e non c’è nessuna pull request aperta. Aperta
gridap/GridapDistributed.jl#209 · 2 assegnatari ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
gridap/GridapDistributed.jl#189 · 1 commento ·
-
Issue with DG-SIP and FullyAssembledRowsForse di nuovo libera @amartinhuertas l’ha presa 358 giorni fa e non c’è nessuna pull request aperta. Aperta
gridap/GridapDistributed.jl#186 · 20 commenti · 1 assegnatario ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
gridap/GridapDistributed.jl#173 · 1 commento ·
Tutte le issue di gridap/GridapDistributed.jl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rfordatascience/tidytuesday#1098 ·
-
`SplitRungeKutta` time steppers never call `update_lagrangian_particle_state!`, so particle `tracked_fields` are never updatedForse già presa @ali-ramadhan l’ha presa oggi. Apertabug 🐞
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
CliMA/Oceananigans.jl#6381 ·
I maintainer di solito rispondono entro 1 giorno
-
ci system:windows test
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Single-column TKE example: boundary-layer depth description doesn't match Han & Bretherton (2019)Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
NumericalEarth/Breeze.jl#1143 ·
I maintainer di solito rispondono entro 1 giorno